question

Chandler avatar image
0 Likes"
Chandler asked Jeanette F commented

Escort OR Transport Patient, based on a label value?

I have tried this several ways using sub flows, and I keep getting errors that are slightly beyond my ability to understand. I'm strongly considering doing it the dumb way... but I know the capability is in here.

Before I get too deep into troubleshooting, is there an accepted way to do this?

I want to transport only patients that need it and escort others (or have them walk). For example, this occurs frequently when having patients walk to the waiting area or exiting the model from a low acuity room in our project. It is cumbersome to have a decision that sorts out those needing transport and then have them move by a different process (escort vs. transport).

Transport and Escort themselves are sub-flows. I tried to simply hybridize them, but I keep getting errors stemming from not being able to access some label values which seem to be applied within the Escort/Transport objects, so I can't figure out how to match that structure completely.

Is this a sub-flow thing? Or would there be a simpler way?

Thanks!

FlexSim 23.1.0
healthcare
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·
@Chandler Can you attach a sample model with what you're trying?
0 Likes 0 ·
Chandler avatar image Chandler Matthew Gillespie ♦♦ commented ·
Sure. I'll have to move the logic over from our design model, but I'll get that out as quickly as I can.
0 Likes 0 ·
Chandler avatar image Chandler commented ·

I am following up with my own comment here because I have something that works. Though I'm still wrapping my head around some of the specifics. @Matthew Gillespie if you can confirm that I understand this correctly that would be very helpful.

----

Yesterday, I tried to build a subflow from the contents of the inner flow of both the transport and escort objects. That was very complex and was throwing totally different errors. (And I'd like to better understand what's happening under the hood, but in the meantime I found another way)

Today I just made a subflow that uses those objects as they are and it is currently working as expected:


EscortOrTransport_internalSubFLow.fsm

The "decide" in the subflow is based on a label "needsTransport" assigned in the arrivals source. That's intentionally placed in arrivals and not at a later stage.

I assign labels in the Execute Subflow object, which are accessed on the token in the subflow:

screenshot-2023-04-28-110515.png


Here I pass in explicitly acquired location, staff, and the existing needsTransport label (these are all decided on subflow start). But I pass in a reference to the Transport resource object in the flow since that will be acquired inside the subflow (or not depending on patient needs)

It's in the Sub-Sub flow that my understanding gets a little fuzzy... (or maybe I have it?)

In the Acquire Transport, I point to token.transport so that it will choose from the resource in the main flow.

screenshot-2023-04-28-111528.png

But after that, I'm no longer accessing the subflow token label, instead accessing the patient label patient.Transports[1], since that was assigned in front of that list (that's going to be necessary down the line). However, since destination and staff are already decided and passed in explicitly, I reference the token labels I created.

When I release the transport, I also release the transport on the patient list.

Does that make sense?

----

Further questions:

When I will have multiple staff transporting a patient, and lets say it's not the full list of aquired staff but only the last X of Y (those acquired in the current flow). How would I use that info?


0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Chandler, was Matthew Gillespie'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 0 ·

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

This looks pretty good to me, but you should change the Release Transport so that it says "token.transport" in the Transport Resource field. That field needs to point at the resource you're releasing from.

You also don't have to create a new needsTransport label in the Escort x Transport activity. The Decide activity could just reference patient.needsTransport directly.

If you want to get the last X acquired objects on a label you could use the Array.slice() method like

patient.Staff.slice(1, X +1) (since the last acquired are at the start of the array)

So to get the last 3 you would say

patient.Staff.slice(1, 4)
· 2
5 |100000

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

Chandler avatar image Chandler commented ·

Ok thanks!

I am getting the following errors in the compiler console when I remove the token.needsTransport and try to reference patient.needsTransport:


Flexscript Error MODEL:/Tools/ProcessFlow/Transport x Escort/Decide>variables/decision Line 9 Undefined variable patient being used.
Flexscript Error MODEL:/Tools/ProcessFlow/Transport x Escort/Decide>variables/decision Line 9 Data type void does not support property needsTransport


0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Chandler commented ·
For some reason, the variable 'patient' isn't defined in the header of the Send Token To field in your model.


It works for me if I re-pick that option by clicking the dropdown next to the field and picking Conditional Decide.

0 Likes 0 ·

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.