hi,
how to extract the valid value of the delimited string.
example: from the string of words below i should fetch he value of 'VARIABLE' which is 12345
this is an;VARIABLE=12345;example for my requirement
the strings are repetitive and i may receive NULL values for the VARIABLE. in such a case i must fetch the first valid value.
example:this is an;VARIABLE=;example for my requirement this is an;VARIABLE=;example for my requirement this is an;VARIABLE=2168;example for my requirement this is an;VARIABLE=12345;example for my requirement
i should extract the value 2168 from the string of words above.
extract variable from delimited string of words
Moderators: chulett, rschirm, roy
Fairly simple in a Server routine:
Loop through the string using Field() with ";" as the delimiter,
..Use Index() to see if "VARIABLE=" is in the token,
....If yes, Field() again with "=" as the delimiterm take 2nd field,
..Stop when first non-null value found or you run out of tokens.
Sorry, but not sure what the PX secret would be.
Loop through the string using Field() with ";" as the delimiter,
..Use Index() to see if "VARIABLE=" is in the token,
....If yes, Field() again with "=" as the delimiterm take 2nd field,
..Stop when first non-null value found or you run out of tokens.
Sorry, but not sure what the PX secret would be.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Using a BASIC Transformer stage
Code: Select all
If Index(InLink.TheString,"VARIABLE=",1) Then MatchField(InLink.TheString,"0X'VARIABLE='0N0X",3) Else @NULL
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Can't think of one that will reliably handle an arbitrary length numeric value. Other than a custom parallel routine, of course.
But the BASIC Transformer is a parallel job solution.
But the BASIC Transformer is a parallel job solution.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.