question

Tomi Kosunen avatar image
1 Like"
Tomi Kosunen asked Jason Lightfoot edited

ProcessFlow connections

How do I get the connection name of an (ProcessFlow) activity? I have a decision activity that is connected to two activities. The connections have names (like 5% and 95%) and I'd like to use the connection name when select the output for the token.

process flowconnections
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
0 Likes"
Matthew Gillespie answered Jason Lightfoot edited

Just reference the name of the connector instead of the rank:

See attached model: connectornamed.fsm


connectors.png (21.8 KiB)
connectornamed.fsm (22.7 KiB)
· 9
5 |100000

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

Tomi Kosunen avatar image Tomi Kosunen commented ·

Thanks for the answer Matthew. I still would like to use the connection name as then I could easily create more flexible process blocks for my needs. So is it possible to get the text out from the connection node?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Tomi Kosunen commented ·

getname(node("1+",rank(connectionsout(<activity>),<connectionrank>)))

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Jason Lightfoot ♦ commented ·

so in the decide code:

getname(node("1+",rank(connectionsout(activity),1)))

and:

getname(node("1+",rank(connectionsout(activity),2)))

will return "95%" and "5%" depending on which is port 1 and which is port 2.

0 Likes 0 ·
Show more comments
Joerg Vogel avatar image Joerg Vogel Tomi Kosunen commented ·

I can only think of the function

 ipopno( object, port number); // used as:

 ipopno(getactivity(processFlow, "Custom Code"),1)

Wherein "custom code" is the name of activity the coneection goes to. But you still need the inport number or rank of the activity.

0 Likes 0 ·
Tomi Kosunen avatar image Tomi Kosunen commented ·

Thanks, now it works!

string connection_name = "";
int my_rank_no = 1;
treenode currobj = first(connectionsout(activity));
while (objectexists(currobj)) {
connection_name = getname(node("1+",rank(connectionsout(activity),my_rank_no)));
my_rank_no++;
currobj = next(currobj);
}
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Tomi Kosunen commented ·

with that construct you could remove my_rank_no completely and just use:

connection_name=getname(node("1+",currobj));

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Tomi Kosunen commented ·

What are you doing with this code? Unless this is a part of a more complicated script I don't see why this is any better than just using the connection rank.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Matthew Gillespie ♦♦ commented ·

I'm guessing the idea is to just put the percentages on the connectors in the process flow and have the logic figure out which tokens to send where purely based on that - avoiding the need to edit the decision activity. As you say - part of a bigger script.

0 Likes 0 ·

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.