Hi all,
I have a requirement where in I need to convert some values in a tables below.
From------------------------->To
===================================
111,22,3245,44 ------------> ##111,###22,#3245,###44
32,434-----------------------> ###32,##434
1232,3432,54,54334-------> #1232,#3432,###54,54334
.
.
.
===================================
Rule
- To pad the input data to a make it a total of 5 characters(left Pad the remaining with '#')
- The number of values in a coulmn is not fixed.
- The number of rows is not known.
I can convert the first value by using FMT and Field
FMT(Field(In.Value,',',1),"5'#'R")
How can I change it for all the values in the input?
Any inputs appreciated?
Text manipulation
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Can be done without a routine.
This converted the comma-delimited string to a dynamic array, applied the Fmts() function to the dynamic array element-by-element, then converted the dynamic array back to a comma-delimited string.
Code: Select all
Convert(@FM,",",Fmts(Convert(",",@FM,InLink.TheString),"5'#'R"))
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.
Cool, hadn't stumbled over that particular function before this. And no wonder, it's nowhere to be found in the online help. I guess it's time for you to once again advise that I read and commit to memory the entire DataStage BASIC Guide. ![Wink :wink:](./images/smilies/icon_wink.gif)
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers