Idea

Mischa Spelt avatar image
0 Likes"
Mischa Spelt suggested

Make popups in List expressions a bit more flexible

I ran into the problem today where I had a token with an "item" label, that references an object in the model.

I also had an Operator resource with a direct reference and multiplicity, so no Group. I wanted to create a "distance" field on the Resource, to determine the distance from puller.item (instead of puller) to the operator. However, the code assumes that the physical object is the puller, and when acquiring a resource I cannot specify another puller, so I ended up rewriting the default code to the below, which gives me a nice popup straight in the List window.

Perhaps it is a simple but useful extension if some of the pre-defined options supported this (either with the simple popup or a more complex popup where I can also enter "Label: item")

treenode value = param(1);
treenode puller = param(2);
treenode entry = param(3);
double pushTime = param(4);

/**First Travel Destination of Task Sequence */
treenode taskSequence = /**/puller/**/;
/**\n Or Travel Distance to */
treenode travelDistanceToDirect = /**/getlabel(puller, "item")/**/;

if (!objectexists(puller))
	return GLOBAL_UNREACHABLE;
treenode destObject = NULL;
if (isclasstype(puller, "TaskSequence")) {
	int travelTask = findmatch(getnroftasks(taskSequence), gettasktype(taskSequence, count) == TASKTYPE_TRAVEL);
	if (travelTask) {
		destObject = gettaskinvolved(taskSequence, travelTask, 1);
	}
} else {
	updatelocations(travelDistanceToDirect);
	destObject = travelDistanceToDirect;
}
if (objectexists(destObject)) {
	updatelocations(value);
	return distancetotravel(value, destObject);
}
return GLOBAL_UNREACHABLE;
process flowresourceslist entriespullerexpression field
5 |100000

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

No Comments

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.