Command that returns patient destination?

Command that returns patient destination?

jenric_ng
Not applicable
19 Views
4 Replies
Message 1 of 5

Command that returns patient destination?

jenric_ng
Not applicable

[ FlexSim HC 5.3.0 ]

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

0 Likes
Accepted solutions (1)
20 Views
4 Replies
Replies (4)
Message 2 of 5

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution
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);



Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 3 of 5

jenric_ng
Not applicable

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

0 Likes
Message 4 of 5

jenric_ng
Not applicable

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

0 Likes
Message 5 of 5

Matthew_Gillespie
Autodesk
Autodesk

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;
	}
}


Matthew Gillespie
FlexSim Software Developer

0 Likes