How to modify patient label based on user input ?

How to modify patient label based on user input ?

leah_r
Not applicable
24 Views
6 Replies
Message 1 of 7

How to modify patient label based on user input ?

leah_r
Not applicable

[ FlexSim 22.1.0 ]

Hello !

I want my user to be able to modify the label of my patients.

In order to do this, I tried using the following function by putting it at the very start of the process in a custom code.

1658243029538.png

However, I am not very comfortable with the tree view and flexscript yet...

Let's say I have an incoming patient with a label called label_1

Can I directly modify the patient label with this function ?

If not, where can I at least get the value the user inputed (I do not understand where subodes[3] could lead in the example) ?


Thanks in advance,

Leah

0 Likes
Accepted solutions (1)
25 Views
6 Replies
Replies (6)
Message 2 of 7

moehlmann_fe
Observer
Observer
Accepted solution

This function will directly alter the value of the specified node. So yes, if you pass in the label node it will be changed to match the user input (if the data type is correct).

In the patient flow you have direct access to the patient through 'patient', so the code could look something like this.

// Make sure that the label is present
patient.labels.assert("UserLabel", 0);
// Prompt for value
userinput(patient.labels["UserLabel"], "Please specify label", 1);

userinput_label_fm.fsm

In the example 'subnodes' is used on the model directory itself. So the target node is the label 'myLabel' on the third treenode in the model tree.

1658299797653.png

0 Likes
Message 3 of 7

leah_r
Not applicable
Thank you very much, I managed to make it work !


Is it possible to input several values at the same time (in the same window) ? Or do I have to use the function several times ?


Thanks in advance,

Leah


0 Likes
Message 4 of 7

jason_lightfootVL7B4
Autodesk
Autodesk

You can store multiple inputs in an array label:

treenode temp=person.labels.assert("userString","");
userinput(temp,"test",1);
string userinput=temp.value;
person.labels.assert("userArray",userinput.split(","));

Just enter with a comma seperating the values.


UserInputArray.fsm

Message 5 of 7

leah_r
Not applicable
Amazing, thank you !


I have one last issue regarding that topic: is it possible to make it so the user can input at any time values ?

For instance: the simulation is running, the user wants to change a specific patient label value, the user clicks on some button that opens a window where the user can change the label value, the user closes the window and the simulation goes on with modified values.


0 Likes
Message 6 of 7

jason_lightfootVL7B4
Autodesk
Autodesk
The third parameter to the userinput field tells the model to stop until the input is completed. So then you just need to figure out how/when to trigger that code. That could be by clicking on the patient or through a dashboard or some other custom GUI.
0 Likes
Message 7 of 7

Jeanette_Fullmer
Community Manager
Community Manager

Hi @Leah R, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes