Page 1 of 1
any function to right justify the values in a column
Posted: Wed Feb 16, 2005 3:45 am
by srekant
i am new to datastage.currently i am working on datastage 7.5 PXjobs. I want to right justify the data that is going to target in the transformer.is there any function to do it.
Posted: Wed Feb 16, 2005 5:10 am
by NewPXUser
From my experience (which is simple and straight-forward), try using stage variables in the way mentioned below.
TrimStr <- Trim(YourLinkVariable)
LengthStr <- Len(TrimStr)
SpaceStr <- Space(50 - LengthStr)
// where 50 is the length of the field. Change if different
YourOutputColumn <- SpaceStr : TrimStr
It worked for me and so I believe it will work for you too.
I tried using -ve value in PadString length but in vain. So if anyone has better idea, please let me know.
Posted: Thu Feb 17, 2005 5:37 am
by srekant
thanks for u r reply
but can u explain ur last step when writing to an output column
cheers
Posted: Thu Feb 17, 2005 5:40 am
by NewPXUser
The derivation of writing to the output (link) column is
SpaceStr : TrimStr
Does that answer your question or was it different?
Hi NewPXUser
Posted: Thu Feb 17, 2005 10:12 am
by chalasaniamith
Hi
I am very new so dont think wrong is this available function TrimStr i think its just
Trim(String) not TrimStr.
Please let me know if i am wrong.
I will correct for myself
Posted: Thu Feb 17, 2005 10:17 am
by Sainath.Srinivasan
As per the steps mentioned, TrimStr is a 'stage variable' obtained as the result of Trim() function. See the mail from NewPXUser.
Posted: Tue Feb 22, 2005 1:51 pm
by T42
Left(Space(maxsizeofstring) : actualstring, maxsizeofString)
Posted: Tue Feb 22, 2005 3:35 pm
by Sainath.Srinivasan
Or maybe it must be
RIGHT(Space(maxsizeofstring) : TRIM(actualstring), maxsizeofString)
Posted: Tue Feb 22, 2005 4:10 pm
by T42
Oops.
Yeah.
Right() is correct.
![Embarassed :oops:](./images/smilies/icon_redface.gif)