question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Matthew Gillespie answered

Two questions about arrays in labels

26689-variablecompanions-2.fsm

Matthew,

I have slightly modified the model you built for me in the posting here. I have a couple of questions related to creating a patient label as an array

  • 1. When I create the label Companions with the Assign Companions & Procedure activity in the flowchart as you did for me, patient.Companions.append(patient) in the activity Patients and Companions Walk to WaitingRoom1 does not throw error messages. When I create the label Companions in the People Settings, the activity patient.Companions.append(patient) does throw error messages.
  • 2.If the patient has 0 or 1 companions, the activity patient.Companions.append(patient) does not put the patient into the array. If the patient has more than one companion, the patient is added to the array. I was expecting the patient to be appended no matter the number of companions.

Thanks for your help.

FlexSim 20.0.3
healthcare2020append to arraysarrays in labels
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

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered
  1. The labels in the People Settings are special stats labels that the People Tables listen to so that the changes to those label values can be tracked for statistical purposes. However, you have to choose their type up front and then you can't change their type during the model run. So it throws an error message when you try to change that label into an array label, and right now Array isn't one of the types you can choose for these special stat labels.
  2. So I made a mistake on this one. I actually didn't want the original Companions label to be updated. I just wanted to make a temporary array to pass into the travel activities. So what I intended to do in that model was use this line of code:
patient.Companions.clone().push(patient)
5 |100000

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