My people-based model has multiple MultiLocation to be used by different types of patients. From a given point on the flow, the patient will acquire the location based on the label type of her/his token matching location's label type.
My piece of code below found the correct reference but seems to unable return the right reference.
/**Custom Code*/ Object current = param(1); Object person = current; treenode activity = param(2); Token token = param(3); treenode processFlow = ownerobject(activity); Array groupe_salle_d_attente = Group("Groupe_salle_d_attente").toFlatArray();//All the waiting rooms print("Token.id=", token.id); print("Token.type=", token.type); for (int i = 1; i <= groupe_salle_d_attente.length; i++) { if (groupe_salle_d_attente[i].as(Object).type == token.type) { print("Salle d'attente=",groupe_salle_d_attente[i]); return groupe_salle_d_attente[i]; } } print("Salle d'attente not found"); return 0.0;
time: 94.012196 exception: Error: Invalid list reference at push to list activity "Chercher_salle_d_attente" in "Circuit_Consultation"