i have a column whose data is like
JOB_ID_NAME=1 or JOB_ID_NAME=12 or JOB_ID_NAME1=1 or JOB_ID_NAME1=112 etc.
i have to get the data which is after '=' from these records like for above records the output shud be 1 or 12 or 1 or 112 .... how can i do that. here the data before and after are dynamic. They are different for each and every row.
how to use substring in transformer
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 80
- Joined: Fri Aug 21, 2009 7:49 am
- Location: India
Code: Select all
FIELD(In.StringColumn,"=",2)
(corrected syntax per Craig's hint)
Last edited by ArndW on Wed Jun 02, 2010 2:32 am, edited 1 time in total.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 80
- Joined: Fri Aug 21, 2009 7:49 am
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
This would be quite simple as a routine. It needs one input argument (the string to be parsed) and will return a delimited string containing the values found.
Code: Select all
FUNCTION GetValues(aTheString)
If UnAssigned(aTheString) Or IsNull(aTheString)
Then
Ans = @NULL
End
Else
TheString = UpCase(aTheString) ; * handle "or" or "OR"
TheString = Ereplace(TheString, " OR ", @VM, -1, 0) ; * convert to dynamic array
Values = Fields(TheString, "=", 2, 1) ; * extract that which follows "="
Ans = Trim(Values)
End
RETURN(Ans)
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.