question

Leah R avatar image
0 Likes"
Leah R asked Jeanette F commented

How to modify patient label based on user input ?

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

FlexSim 22.1.0
flexscriptmodel treeuser input
1658243029538.png (34.5 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jason Lightfoot commented

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.

  1. // Make sure that the label is present
  2. patient.labels.assert("UserLabel", 0);
  3. // Prompt for value
  4. 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


· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.