Page 1 of 1

Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 3:49 pm
by TrevorGoss
Hello to all,

recently we came across an issue that concerns a Master TI that fires sub TIs, which also fire sub TIs. All of the TIs take a parameter of the current year. These are also set as default parameters.

We needed to change the parameter from 2015 to 2016, so we thought we would just have to change the default parameter of the master process, but no...the sub TIs still tried to use the old parameter argument, 2015. In order for us to fix this, we had to change the default parameter arguments to 2016 as well.

Has anyone come across this before? The sub TI of a master process does not use the original parameter argument, it instead uses its own default parameter argument.

This has not always happened to us either, it has worked for us before.

Thanks.

Trevor.

Re: Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 4:10 pm
by qml
TrevorGoss wrote:The sub TI of a master process does not use the original parameter argument, it instead uses its own default parameter argument.
How do you expect the parameter to be passed between TIs if you're not passing it? Naturally the default parameter value of the subprocess will be used in such a case and that is '2015'. It does not matter that the default for the parent process is now something else as nowhere are you passing that to the subprocess!

Re: Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 4:19 pm
by TrevorGoss
qml wrote:
TrevorGoss wrote:The sub TI of a master process does not use the original parameter argument, it instead uses its own default parameter argument.
How do you expect the parameter to be passed between TIs if you're not passing it? Naturally the default parameter value of the subprocess will be used in such a case and that is '2015'. It does not matter that the default for the parent process is now something else as nowhere are you passing that to the subprocess!
Thanks for the response,

Perhaps I should of been clearer in my original post. The Master process, calls the Sub processes, passing the default parameter to the sub process, like so:

MasterTI.....

Code: Select all

ExecuteProcess('SubPro','Year',pYear);
SubPro......

Code: Select all

ExecuteProcess('SubSubPro','Year',pYear);
The Master TI has a default parameter of pYear.

So if the MasterTI is called with a default parameter argument if '2016', we would expect the SubProcess to have '2016', when it is called.

Re: Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 5:05 pm
by qml
Ok, I see.
TrevorGoss wrote:The Master TI has a default parameter of pYear. So if the MasterTI is called with a default parameter argument if '2016', we would expect the SubProcess to have '2016', when it is called.
Can you post the relevant portions of your actual code please? I understand that you have a master TI that calls some subprocesses which execute some sub-subprocesses of their own. I'm interested to see your ExecuteProcess syntax, because right now it's looking as though you are not passing the Year parameter value and hence each process uses its own defaults. If your actual syntax is along the lines of your example then I would agree that a subprocess should be using the value passed from the parent process, even if that was a default value in that parent process. How (from what interface) do you execute the master process, by the way?

Re: Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 6:05 pm
by gtonkin
Hi Trevor,
Can't say I have encountered this problem and I know we are doing some of these chained TI's.

Assume you have checked the obvious like the pYear variable is not set/reset in any of the Sub TI's
May also be worthwhile trying an asciioutput in Prolog and Epilog (to a different file of course) to check the values on entry and exit.

Re: Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 6:27 pm
by lotsaram
Its going to be the obvious answer that wrong param value being passed or else the param isn't passed at all and so the process is running with its defaults. Can't be anything else; code does what it's been programmed to do. Just a matter of finding where you've gone wrong.

Whenever I'm setting up a system I always have the default values of pYear, pMonth etc. set to blank. If the process runs without these params being passed or if passed as blank strings then there is parameter validation code on the prolog to look up current year or current month from a sys settings cube. Then there's never any code changes or resetting of chore or process defaults to do for year rollover.

Re: Parameter of sub process not passing through

Posted: Tue Feb 02, 2016 8:57 pm
by mattgoff
Is "Year" really your param name or is that a placeholder for this post? If the former, "Year" is a reserved word, and you get a modal error if you attempt to use it for a variable name. I would have expected your code to be:

Code: Select all

ExecuteProcess('SubPro','pYear',pYear);

Re: Parameter of sub process not passing through

Posted: Wed Feb 03, 2016 4:13 am
by gtonkin
mattgoff wrote:Is "Year" really your param name or is that a placeholder for this post?
I think Mattgoff has unconvered the answer - If the sub process has a parameter value called 'Year' and is passed a value via a variable of pYear then the sub process probably does not have a variable or parameter called 'pYear,' unless it is set to 'Year' - as per mattgoff, please confirm the actual parameter names and variables too.

Re: Parameter of sub process not passing through

Posted: Wed Feb 03, 2016 10:04 am
by TrevorGoss
Thank you all for your responses,
mattgoff wrote:Is "Year" really your param name or is that a placeholder for this post? If the former, "Year" is a reserved word, and you get a modal error if you attempt to use it for a variable name. I would have expected your code to be:

Code: Select all

ExecuteProcess('SubPro','pYear',pYear);
Correct, the parameter is pYear, rather than Year.
lotsaram wrote:Its going to be the obvious answer that wrong param value being passed or else the param isn't passed at all and so the process is running with its defaults. Can't be anything else; code does what it's been programmed to do. Just a matter of finding where you've gone wrong.

Whenever I'm setting up a system I always have the default values of pYear, pMonth etc. set to blank. If the process runs without these params being passed or if passed as blank strings then there is parameter validation code on the prolog to look up current year or current month from a sys settings cube. Then there's never any code changes or resetting of chore or process defaults to do for year rollover.
the param isn't passed at all and so the process is running with its defaults.
Also correct, the response and code below will demonstrate my discovery,
qml wrote:Ok, I see.
TrevorGoss wrote:The Master TI has a default parameter of pYear. So if the MasterTI is called with a default parameter argument if '2016', we would expect the SubProcess to have '2016', when it is called.
Can you post the relevant portions of your actual code please? I understand that you have a master TI that calls some subprocesses which execute some sub-subprocesses of their own. I'm interested to see your ExecuteProcess syntax, because right now it's looking as though you are not passing the Year parameter value and hence each process uses its own defaults. If your actual syntax is along the lines of your example then I would agree that a subprocess should be using the value passed from the parent process, even if that was a default value in that parent process. How (from what interface) do you execute the master process, by the way?

Code: Select all

	
	vK=1;

	WHILE(vK <= vMaxElement);
		vElement = DIMNM('}Processes', vK);

		IF (SUBST(vElement,1,11) @= 'TI_Transfer' & vElement @<>'TI_Transfer2'&vElement @<>'TI_Transfer_d');
			EXECUTEPROCESS(vElement, 'pYear', pYear, 'TrfVer', TrfVer,'pViewOrData','V');
			EXECUTEPROCESS(vElement, 'pYear', pYear, 'TrfVer', TrfVer,'pViewOrData','D');
			vReturn_value = ExecuteProcess(vElement);
			ASCIIOUTPUT('z:\PrintOutTis1.txt',vElement);
			If(vReturn_value = ProcessExitSeriousError() );
				ASCIIOUTPUT('z:\TiFailedSerious.txt','Process', vElement ,'exited with serious errors at ', TIME, 'on', vNewDate);
			Elseif
			(vReturn_value = ProcessExitMinorError() );
				ASCIIOUTPUT('z:\TiFailedMinor.txt','Process', vElement ,'exited with minor errors at ', TIME, 'on', vNewDate);

			Elseif
			(vReturn_value = ProcessExitOnInit() );
				ASCIIOUTPUT('z:\TiFailedOnINIT.txt','Process', vElement ,'exited on init at ', TIME, 'on', vNewDate);

			Endif;
		ENDIF;
		vK=vK+1;
		vReturn = CELLPUTN(0,'TriggerControl', 'IsRunning', 'TriggerOption');

		
		
		CubeSetLogChanges('CalenderManualTriggerControl',0);
This code is looping through the }Processes dimension, finding all the right processes to pass as arguments into the ExecuteProcess function, note this line of code:

Code: Select all

vReturn_value = ExecuteProcess(vElement);
This was done a while ago, as a test to solve a different issue, the 'vReturn_Value' is storing the return value of the ExecuteProcess call, as it returns errors. This code was never taken out, which is amazing.

Thank you all for your responses, I never new 'Year' was a keyword and I will take the idea of leaving all the default parameters to blank, especially if it is being passed as a sub TI. The reason why we did set up default values, was in case we wanted to run the Sub Tis on its own.

Re: Parameter of sub process not passing through

Posted: Wed Feb 03, 2016 1:04 pm
by Wim Gielis
TrevorGoss wrote:I will take the idea of leaving all the default parameters to blank, especially if it is being passed as a sub TI. The reason why we did set up default values, was in case we wanted to run the Sub Tis on its own.
Indeed, I also tend to put default values in the TI processes.
In case the TI is run on its own from the Server Explorer, it's good to have the "format" of the input.
Like: year could be 16 (sometimes) or 2016 or Y2016.
Month could be 05 or 5 or May or ...
Or if the parameter asks for a YTD month, would it be YTD 05 or 05 ?

I do know that we can program around this and I almost always do so, and I also know the concept of aliases ;-)
but still being shown possible default values and their "format" (at runtime) is useful.

Re: Parameter of sub process not passing through

Posted: Wed Feb 03, 2016 2:57 pm
by TrevorGoss
Wim Gielis wrote:
TrevorGoss wrote:I will take the idea of leaving all the default parameters to blank, especially if it is being passed as a sub TI. The reason why we did set up default values, was in case we wanted to run the Sub Tis on its own.
Indeed, I also tend to put default values in the TI processes.
In case the TI is run on its own from the Server Explorer, it's good to have the "format" of the input.
Like: year could be 16 (sometimes) or 2016 or Y2016.
Month could be 05 or 5 or May or ...
Or if the parameter asks for a YTD month, would it be YTD 05 or 05 ?
quote]

We have a Control Cube for items such as Current Period, Previous Period and the like.

Of course, for current year we could always have no parameter and use this code:

Code: Select all

vYear = TIMST(NOW,'\Y');