Best Practice Question:Arguments in Main File

Hi Everyone.

I have an organizational/best practice question. In my main file there is 1 state machine.

In the state machine scope I have some variables (These are mostly constants that don’t change throughout the entire process.)

Then I have some in/out arguments. All my arguments in my state machine scope are in/out because the state machine has become somewhat of a controller, passing arguments into workflows and getting results out of them to be passed into others.

Long story short, I got an error on Orchestrator because I have an in/out argument of the type DataTable that is too big to be an output of the process. I can clear the datatable variable at the end of the state machine to fix this problem, but then I still have output arguments at the end of the state machine that I do not need.

Am I organizing my arguments wrong? I don’t need to have any output arguments to pass after the process is completed, but I thought I needed them to be in/out to pass them into other workflows during the state machine process.

Should I make my ioArguments variables instead if I don’t need to pass them out of the state machine?

Let me know.

If i understood those are arguments of the state machine and not of the main sequence of the process, but is good practice (specially if they are big) to clear variables that have big scope, when you dont need them (for datatables you can use Clear activity).

1 Like


Yah that would actually fix the problem in using CLEAR DATATABLE activity
But for this

Using IN/OUT argument is not a problem but taking the consideration of good practice always create variables or arguments only when they are actually needed
Especially when having multiple workflows In a state it will be always easy to handle the arguments of any direction only if they are actually used else it will lead to unnecessary memory conception and also will confuse where those arguments were passed and used while calling them with INVOKE WORKFLOW file
So use them

If we are passing them out of the current workflow or state it’s advisable to use LOCAL VARIABLES instead of arguments
That is create and use those variable ms within the same workflow or state

So that we won’t miss arguments which are actually to be used and it will be easy to manage

Cheers @RoboDan

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.