question

Lauren K avatar image
0 Likes"
Lauren K asked Ben Wilson commented

Acquire staff from group that matches location group

OncologyW1_1.fsm

I am modeling a clinic that has team centers where the team A location only uses Team A Nurses. The rooms are picked at random based on availability so I want to have the person acquire a room and then recognize what team it is in and assign a nurse from that team group. This is in the block "Acquire Room & Corresponding Nurse" on the left side of the patient flow. I was trying something in the code editor of the Team Nurse Staff Resource but was having issues with the getlastacquiredresource function.

FlexSim 19.1.2
flexsim 19.1.2acquire resourcestaff
oncologyw1-1.fsm (1.0 MiB)
· 3
5 |100000

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

Nick Brown avatar image Nick Brown commented ·

@Lauren K I am dealing with the getlastacquiredresource function at the moment as well. I looked into your model and noticed you spelled it as lastacquiredresource instead of getlastacquiredresource. Give that a try?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

@Lauren K The getlastacquiredresource() command was added in version 19.2, but you are using version 19.1, so that command won't work in the older version you're using.

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Lauren K, was Matthew Gillespie's answer helpful? If so, please click the red "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

It looks like you pasted in the code of a pickoption from a later version of FlexSim. As I explained in the comment above, the getlastacquiredresource() command wasn't added until 19.2 and can't be used in 19.1. However, you can still use the rest of the code you pasted in, just use patient.Locations[1] (the last location acquired) as the case value. Then fill out the if - then choices the way you want. Something like this:

Variant caseValue = patient.Locations[1];

Array ifChoices = [];
Array thenChoices = [];

ifChoices.push(Group("Team A Rooms"));     thenChoices.push(Group("Team A Nurses"));
ifChoices.push(Group("Team B Exams"));     thenChoices.push(Group("Team B Nurses"));
ifChoices.push(Group("Team C"));         thenChoices.push(Group("Team C Nurses"));

for (int i = 1; i <= ifChoices.length; i++) {
    Variant choice = ifChoices[i];
    if (choice == caseValue || (isclasstype(choice, "Group") && choice.as(Group).isMember(caseValue, 1)))
        return thenChoices[i];    
}

return Group("Staff");

See the attached model oncologyw1-1_2.fsm


oncologyw1-1-2.fsm (1018.0 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.