problems in string formating.
Moderators: chulett, rschirm, roy
problems in string formating.
Hi All,
In one of Our PX job,we need to cancatenate several stage variables to form a line of text which will be used for Email.
we are using a transformer to do this cancatenation and populating
a .TXT file which will be used by Dsmail.
we are facing issues while doing the cancatenation.
Irrespective of length of the first variable, we need to print the second in a particular position.
for example
if i have col1 and col2, we want to print col2 in 20th position..no matter about the string length of col1.
for this, currently we are using the space function in the transformer.
col1 : space(20-len(col1)) : col2
which is not at all working where as if we use space() separately or len() separately it's working.
any valuable idea's to achive this.
Thanks in advance
Edi
In one of Our PX job,we need to cancatenate several stage variables to form a line of text which will be used for Email.
we are using a transformer to do this cancatenation and populating
a .TXT file which will be used by Dsmail.
we are facing issues while doing the cancatenation.
Irrespective of length of the first variable, we need to print the second in a particular position.
for example
if i have col1 and col2, we want to print col2 in 20th position..no matter about the string length of col1.
for this, currently we are using the space function in the transformer.
col1 : space(20-len(col1)) : col2
which is not at all working where as if we use space() separately or len() separately it's working.
any valuable idea's to achive this.
Thanks in advance
Edi
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
Use left function
Hi,
I think left function in transformer stage will resolve your problem, the syntax is as follows
Left(col1,19):col2
now the col2 will start from 20 th opsition.
Thanks&Regards
Nagesh
I think left function in transformer stage will resolve your problem, the syntax is as follows
Left(col1,19):col2
now the col2 will start from 20 th opsition.
Thanks&Regards
Nagesh
NageshSunkoji
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
If you know anything SHARE it.............
If you Don't know anything LEARN it...............
Re: Use left function
No nagesh,Nageshsunkoji wrote:Hi,
I think left function in transformer stage will resolve your problem, the syntax is as follows
Left(col1,19):col2
now the col2 will start from 20 th opsition.
Thanks&Regards
Nagesh
Left() function gives 'n' character from left of the specific set.
But the requirment is different.
regards
kumar
Nobody can give a solution that is certain to work until we know how long these two stage variables are (and presumably therefore the datatypes of the columns that populated them).
One of the earlier solutions works if col1 is less than 20 characters and one works if it is 20 or more characters.
Tell us a bit more about the problem and we can give you a proper answer.
One of the earlier solutions works if col1 is less than 20 characters and one works if it is 20 or more characters.
Tell us a bit more about the problem and we can give you a proper answer.
**Intresting updates**
Helo Rich,Craig,thom,kumar,Nagesh
Thanks Very much Everyone for the valuable inputs.
ok...Here are the updates.
Rich : Your Idea of using str() function is working fine..
here is my exact code in the transformer.
Result :
Thanks Very Much Rich.. :D
Kumar : I tried your Idea of using padstring but I got Fatel error.
Fatel Error
Nagesh : while i was using your idea, nothing Happened...
Result :
Tom : I am able to assign datatype like any other properties for stage variables and it is varchar of 100 for both.
Kindly advise me reagrding this.
so, Thanks again everyone.
Now the Next move... :D
If The string length of "AssetDesc1" is going to be more then expected then i want that should be Printed in the second line (I.e without moving the "AssetDesc2" printing position)
It would be great if..
Expecting all you again here.
Thanks again,
Edi
Please note that totally i am using 5 stage variables like this.for easier look i have mentioned only 2 of them.
Thanks Very much Everyone for the valuable inputs.
ok...Here are the updates.
Rich : Your Idea of using str() function is working fine..
here is my exact code in the transformer.
Code: Select all
AssetDesc1 : STR(" ",38- LEN(AssetDesc1) ) : AssetDesc2
Code: Select all
HITACHI CAPITAL(UK) ORD GBP0.25
Kumar : I tried your Idea of using padstring but I got Fatel error.
Code: Select all
PadString(AssetDesc1," ", (20-Len(AssetDesc1))) : AssetDesc2
Code: Select all
FormatTextLine,0: Failure during execution of operator logic
Code: Select all
Left(AssetDesc1,19): AssetDesc2
Code: Select all
HITACHI CAPITAL(UK)ORD GBP0.25
Code: Select all
What datatype and length are your stage variables
Kindly advise me reagrding this.
so, Thanks again everyone.
Now the Next move... :D
If The string length of "AssetDesc1" is going to be more then expected then i want that should be Printed in the second line (I.e without moving the "AssetDesc2" printing position)
It would be great if..
Code: Select all
xxxxxxxx yyyyy
xxx
Thanks again,
Edi
Please note that totally i am using 5 stage variables like this.for easier look i have mentioned only 2 of them.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: