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