question

Yash Patel avatar image
0 Likes"
Yash Patel asked Jeanette F commented

Knowing Parameters being passed in various code blocks

Where we go and write any code node they Usually start out like

Object current = param(1);
treenode activity = param(2);
Token token = param(3);

Where the value of parameters change based on the place where the code is being written. So, If I want to know what value a certain parameter will have where can I look instead of guessing. Because If I go and write custom code it usually start blank and will not tell me what are the available parameters.

In continuation of this, if I add a code block in process flow show will I know that what paraments are being passed to that code block.

I tried to find in the classes documentation but, it seems I am missing something.

Any type of help will be hugely appreciated.

FlexSim 24.2.1
flexscriptcodeparametersparameter table
· 1
5 |100000

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

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Yash Patel, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

I don't think there's any documentation for this. The basic parameters that appear a lot are mostly pretty self explanatory based on their name though.

current is the object the code is written on (in Process Flow this is either the Process Flow itself or the instance object in case of an Object Process Flow).

More specific parameters are often times commented to explain their function.

1728454114493.png

If the purpose/value of a parameter is unclear, I'm afraid the best and only method to learn is to place a break point in the code and simply look what values get assigned to the variables.

The only codes that start completely empty without a predefined header that I can think of right know are model triggers (which don't have any parameters) or user commands (where the user specifies what needs to be passed into the function and should thus know what to add to the header).


1728454114493.png (9.2 KiB)
· 2
5 |100000

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

Yash Patel avatar image Yash Patel commented ·
Thank Felix, a follow up question. If a code block already has some parameter used, but can there be other parameters that are there but not being passed in the code block but we can use it somehow.


like for the example the screen shot you shared there are 2 params being used but, can there be param 3 param 4 from the model itself and we are not just using them? In that case is there a way for me too know what they might be?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Yash Patel commented ·
You can always check if there are further parameters available by adding more Variant variables to the header. But generally this should not be the case. If you require more information for your code then you should look into other ways to make it accessible (labels, tables, global variables, etc.).
0 Likes 0 ·