question

Mischa Spelt avatar image
1 Like"
Mischa Spelt asked Matthew Gillespie answered

Find ProcessFlow activity by name and type

Is there a way to find a ProcessFlow activity not only by name, but also by type?

Consider for example the common use case where I have a subflow, and Run Subflow activities with the same name:

When I use

getactivity( "ProcessFlow", "Generate items" )

I (may) get the Run Subflow activity instead of the Start activity of the subflow.

Of course I could rename one of them but this may not always be possible or practical, and sometimes this is the most natural name (I could train myself to start all Start activities' names with "Subflow: ", for example, but that's just ugly). Is there a way I can request an activity by type, e.g.

getactivity( "ProcessFlow", "Generate items", "ProcessFlow::Start" ) 

or at least get a list of all matching activities so I can filter by them, e.g.

var activities = getactivities( "ProcessFlow", "Generate items" );
for( int i = 1; i <= activities.length; i++ ) {
  if( isclasstype( activities[i], "ProcessFlow::Start" ) ) {
    // Found the one I need!
    break;
  }
}

(Technically, I could use forobjecttreeunder here, I guess...)

I even tried

getactivity( "ProcessFlow", "Generate items~2", "ProcessFlow::Start" ) 

but that didn't work either, and I think that PF activities get moved around the tree as you select or edit them anyway.

FlexSim 20.2.0
processflowflexsim 20.2.0getactivity
1595842773437.png (18.0 KiB)
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
3 Likes"
Matthew Gillespie answered

There's not currently a way to do this through code, but you can do it in the View Activities window:

The tilde-number suffix (i.e ~2) also works in a path with the Model.find() method:

Model.find("Tools/ProcessFlow/ProcessFlow/Generate items~2")



1595868797311.png (15.4 KiB)
5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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