question

Chandler avatar image
0 Likes"
Chandler asked Jason Lightfoot commented

Access patient labels directly on token in sub flow?

Hoping this is a simple question. I haven't messed with subflows recently because they were tripping me up and here's what it boils down to.


1. I can pass in acquired resources, agnostic of what label they've been acquired to.

2. I can pass in references to resource activities, to be acquired in the subflow.

3. I can pass in a reference to the patient on a label of the token.


The issue I am having is what led me to do #3. When in the sub-flow I use a conditional statement that checks the value of a label on the patient (such as: patient.needsTransport) I get errors like these:

Flexscript ErrorMODEL:/Tools/ProcessFlow/PtFlow_Dev/Patient Needs Transport?~14>variables/decision Line 9Undefined variable patient being used.
Flexscript ErrorMODEL:/Tools/ProcessFlow/PtFlow_Dev/Patient Needs Transport?~14>variables/decision Line 9Data type void does not support property needsTransport
Flexscript ErrorMODEL:/Tools/ProcessFlow/PtFlow_Dev/Patient Needs Transport?~14>variables/decision
Could not finish parsing because of previous errors

... which leads me to believe that the variable "patient" is not valid in the context of the subflow. I would think that I could access patient labels directly on the token by using that patient.___ syntax, since I can do that on the parent token, and I am able to access labels on the parent token.

What is the cleanest way to do this so that I don't have to store a reference to the patient in a label on the child token within the subflow?


I can provide an example if needed but I will have to take it out of context.

FlexSim 23.2.1
labelshealthcaresub flow
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Hi @Chandler, was Jason Lightfoot'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 comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

In your patient flow source add the patient label and set it to current/patient (if you type current it will change it to patient).

1703173940553.png

Then in your subflow you can refer to

token.patient.mylabel


Advanced user notes:

Note that in most of the activity headers 'patient/person' is just define as a local variable for you to use in your fields, and is set to the member object instance of the object process flow:

Object current = param(1); 
Object patient = current;
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);

.. so it might be nice to have the same facility in a subflow. However the runsubflow activity doesn't allow you to set the instance object by default so you can't invoke the subflow for the patient object and use the same header construct that way. You could however use Token.create and wait for it to complete the process and by specifying the patient as the instance have the same/similar headers with patient/person predefined.


1703173940553.png (23.3 KiB)
5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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