question

michael.smith avatar image
0 Likes"
michael.smith asked Matt Long commented

Process Flow Resources in Case Statements across flows

I'm using a central set of resources on the main flow page for all my processes (they are shared)

What is the correct syntax for entering the reference in the case statement

by default on the same page as the resource it would be

case /**\nCase: *//**/1/**/: Resource = /** Resource: *//**/"Resource1"/**/;break; case /**\nCase: *//**/2/**/: Resource = /** Resource: *//**/"Resource2"/**/;break;

FlexSim 16.0.1
process flow
5 |100000

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

michael.smith avatar image
0 Likes"
michael.smith answered Matthew Gillespie converted comment to answer

As an update I spotted that the getactivity command determines the target page

treenode current = param(1);
treenode activity = param(2);
treenode token = param(3);
treenode processFlow = ownerobject(activity);
treenode Target = node("Tools/ProcessFlow/Target Process Flow",model());//<Inserted Line
/***popup:ActivityByCase:classType=Resource*/
/***tag:desc*//**Resource By Case*/
int case_val = /** \nCase Function: *//***tag:ValueFunc*//**/gettablenum("Rehabilitation",1,14)/**/;
string Resource = "";
/** \nCases:\n*/
switch (case_val) {
/***tagex:data*/
case /**\nCase: *//**/1/**/: Resource = /** Resource: *//**/"R1"/**/;break;
case /**\nCase: *//**/2/**/: Resource = /** Resource: *//**/"R2"/**/;break;
case /**\nCase: *//**/3/**/: Resource = /** Resource: *//**/"R3"/**/;break;
case /**\nCase: *//**/4/**/: Resource = /** Resource: *//**/"R4"/**/;break;
case /**\nCase: *//**/5/**/: Resource = /** Resource: *//**/"R5"/**/;break;
case /**\nCase: *//**/6/**/: Resource = /** Resource: *//**/"R6"/**/;break;/***//**/ /**/
default: Resource = /**\nDefault:*//***tag:default*//**/"Resource"/**/;break;
}
return getactivity(Target, Resource); //<Modified Line
/** \nNote: Case values must be positive integers.*/

Re pointing the look up destination by adding another line means I can reference the other PF's. As this is something that will probably be done a lot perhaps adding a target PF option to the trigger would help. If there is a neater solution please let me know

5 |100000

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

Marco Baccalaro avatar image
0 Likes"
Marco Baccalaro answered Matt Long commented

The syntax is correct. I tried it in the attached model.


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

michael.smith avatar image michael.smith commented ·

Thanks Marco, that is the right Syntax for the same PF page but I'm trying to reference across pages/flows.

0 Likes 0 ·
Marco Baccalaro avatar image Marco Baccalaro commented ·

Ok, now I know what you mean. I tried too but no way, seems Process Flow doesn't want you to use resources on other Process Flows. I think it's because of the link that cannot be maintained between the token and the resource if they are in different Process Flows.

0 Likes 0 ·
Matt Long avatar image Matt Long Marco Baccalaro commented ·

It's actually perfectly legal to acquire resources, push/pull from lists and enter/exit zones that are contained in a General Process Flow object from any other General, Fixed Resource, Task Executer or Sub Flow. There just isn't a good Case pick option for doing so at this time. That's something we'll have to look at adding.

1 Like 1 ·