question

SKH avatar image
0 Likes"
SKH asked Matthew Gillespie commented

Command that returns patient destination?

getname(patientlocation) is to get current patient location. May i know what is the function and variable to get patient destination in flexscipt?

FlexSim HC 5.3.0
patient destination
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 Matthew Gillespie commented
getdestination(patient)

From the documentation for that command:

Parameters

(obj traveler, [num transferactivityID])

Description

Gets the current, most recent, or pending destination of the traveler object. If the traveler is a patient, you should specify the activity ID number of the patient's transfer activity that you'd like to know the associated destination of. If the traveler is a patient and no transfer activity ID is specified, then the command will use the ID of the most recent activity started on the patient. If the traveler is a resource, rather than a patient, then the command assumes that the resource currently has an active task sequence containing a travel task, and it will use the most recent travel task (or if none have occured yet, the next pending travel task) to determine the destination.

Example

getdestination(patient, 100);

· 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.

SKH avatar image SKH commented ·

I am using HC 5.1.0. There is no getdestination function. Is there any method to get patient destination?

0 Likes 0 ·
SKH avatar image SKH commented ·

Any advice on how to get destination for user of HC 5.1?

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

The getdestination command handles a lot of different scenarios for you. I would recommend updating to the latest version (5.3.8) to take advantage of this feature and all the other bug fixes and features added in newer versions.

Otherwise you could try using these code snippets I pulled out of the body of that command.

If the activity is an escort or transport patient activity:

int activityRow = torownum(patient, activityID);
treenode destination = tonode(gettablevalue(var(patient, VAR_ActivityTable), activityRow, COL_ResourceDestinationName));

If the activity is a patient travels unattended activity:

treenode activets = gettasksequence(patient, 0);
// Loop through the tasks of the activets and if a travel task can be found, get its destination
int nrtasks = gettotalnroftasks(activets);

for (index = 1; index <= nrtasks; index++)
{
	if (gettasktype(activets, index) == TASKTYPE_TRAVEL)
	{
		destination = gettaskinvolved(activets, index, 1);
		break;
	}
}
0 Likes 0 ·