Hi all,
I have created a process with some "PowershellComponentNet4 - ExecuteScript" components, in the version 9.1 of the product.
One of these steps, returns 2 informations that I have concatenated for passing it to the next steps. For e.g. <string1>#<string2>.
What I am trying to do is: in the next step, split this parameter in two so I will can use them directly in the script step.
I have tried to do that directly with PS code and within a VB script but in both cases the result was the samestring that i pass as parameter.
This is an example code of what I did:
In the pre-script generating
Dim var As String = "&OUT(outParam)&" values("out") = var
In the process step, I tried also to use IndexOf with SubString function or to use Split functions.
I tried to do a custom split function: this is the code.
VB Script:
Public Function CCC_splitOutParams (ByVal str As String, index As Integer) As String Dim val() As String = str.Split(New Char() {"#"c}) If index > -1 And index < val.Length Then Return val(index) Else Return "ERROR - INDEX OUT OF BOUNDS" End If End Function
If I test it from designer, It works fine.
To run the VB script in my PS step, I did:
Dim test1 As String = CCC_splitOutParams( CStr(ts) , 0) Dim test2 As String = CCC_splitOutParams( CStr(ts) , 1)
test1 returns the entire string passed as parameter (str variable) and test2 returns "ERROR - INDEX OUT OF BOUNDS".
Can you please help me to understand why it doesn't work? Where and what am I wrong?
Thank you in advance