Script optional parameters in process step

Hi,

i have the following script which has optional parameters:

Sub CCC_RunQBMLimitedSQL(
statementNameOrUID As String,
Optional ByVal parameter1Name As String = Nothing,
Optional ByVal parameter1Value As Object = Nothing,
Optional ByVal parameter2Name As String = Nothing,
Optional ByVal parameter2Value As Object = Nothing,
Optional ByVal parameter3Name As String = Nothing,
Optional ByVal parameter3Value As Object = Nothing)

However, if I try to run this script from a process step with only the mandatory statementNameOrUID parameter (ParameterValue0) set, I get the following error: 

ErrorMessages (2024-05-13 12:08:01.880) [829004] Wrong number of parameters (expected 7, got 1)
at StdioProcessor.StdioProcessor._Execute(Job job)
at VI.JobService.JobComponents.ScriptComponent.Activate(String task)
at VI.JobService.JobComponents.ScriptComponent._TaskScriptExec()

Is there any configuration that I am missing in the process step or elsewhere? Or is it simply not possible to omit optional parameters when calling a script from a process step?

Thank you for your support!

  • You can try to change the ScriptName parameter to the following CCC_RunQBMLimitedSQL(String,String,Object,String,Object,String,Object) and see if that works. 

    If not, you need to create some wrapper scripts without the optional number of parameters that call your main script internally.

    In addition, I do not think that a parameter of type Object can be provided by the ScriptComponent, but I do not know for sure.

  • Thank you for the quick reply Slight smile

    I tried to change the ScriptName parameter to CCC_RunQBMLimitedSQL(String,String,Object,String,Object,String,Object). Sadly, while the error message changes to "Parameter count mismatch", the end result ist the same.

    I also tried CCC_RunQBMLimitedSQL(String), as I only want to supply the mandatory first paramter, but that also results in an error message: "The script 'CCC_RunQBMLimitedSQL(String)' does not exist.".

    It would seem that the ScriptComponent simply does not support optional parameters and I will have to work with overloading/wrapping of the script.

    The "Object" type is simply a workaround to allow for both integers and strings (or any other valid DbVal.ValType) to be passed.