Page 1 of 1

Concatenate issue

Posted: Fri Sep 08, 2006 1:25 am
by Anee
Hi

Cud anyone tell me wats wrong with the below stmt... I've used this stmt to concatenate a " to the rec if it contains QuoteChar. but the output returned is that every stmt is appended with a 1 at the end.....

if(DSLink12.F1[1,9]= "QUOTECHAR") THEN DSLink12.F1 :'"' else DSLink12.F2..

thanx
Anee

Posted: Fri Sep 08, 2006 6:52 am
by kcbland
I can't tell but a I am assuming you are using a single quote, a double quote, and then a single quote in the statement. What your statement is doing is if the first nine characters of link column DSLink12.F1 is the text "QUOTECHAR" then append your quote to that entire link column value, otherwise return link column DSLink12.F2. So, my guess is that either your text never starts with QUOTECHAR and F2 must contain the value 1.

Posted: Fri Sep 08, 2006 9:03 am
by kumar_s
Hope you are not getting confused with the new line character seen through a special text editior.

Posted: Sun Sep 10, 2006 3:09 am
by ray.wurlod
Does the upper case string "QUOTECHAR" ever appear in the first nine positions of F1? And what's the value of F2?

Posted: Sun Sep 10, 2006 10:33 pm
by Anee
Hi

QUOTECHAR does appear in the firstnine postions of F1. and F2 value of this rec is null
Inspite of this, 1 is appended at the end to all the values

Thanx

what is stmt?

Posted: Sun Sep 10, 2006 10:49 pm
by changming
what is stmt anyway?
try to cat in this way
link.field :''':'''

Posted: Sun Sep 10, 2006 10:55 pm
by Anee
Hi changming

It still doesnt work. Infact i doubt the stmt u wanted me to add in the transformer stage is correct.. is it possible to concatenate the way u told???

Posted: Sun Sep 10, 2006 11:09 pm
by changming
Anee wrote:Hi changming

It still doesnt work. Infact i doubt the stmt u wanted me to add in the transformer stage is correct.. is it possible to concatenate the way u told???
sorry, I tried, that is wrong. sorry for misleading you. Check your file whether it is writen by other link.

Posted: Mon Sep 11, 2006 4:01 am
by kumar_s
Hi Anee, Where do you see the '1'. Is it in view data or in output flat file?
What if you concatinate with other character?
Are you trying with any stage variable?

Re: Concatenate issue

Posted: Mon Sep 11, 2006 3:56 pm
by ray.wurlod
Anee wrote:Hi

Cud anyone tell me wats wrong with the below stmt... I've used this stmt to concatenate a " to the rec if it contains QuoteChar. but the output returned is that every stmt is appended with a 1 at the end.....

if(DSLink12.F1[1,9]= "QUOTECHAR") THEN DSLink12.F1 :'"' else DSLink12.F2..

thanx
Anee
Is that the entire expression? (What does the ".." at the end signify?)

If it is the entire expression, try

Code: Select all

If (DSLink12.F1[1,9] = "QUOTECHAR") THEN DSLink12.F1 : Char(34) else  DSLink12.F2
Here I've replaced the quoted quote character with Char(34) - it would be more efficient to initialize a stage variable with Char(34) and to use the stage variable (perhaps named svDoubleQuoteChar), but it gets the idea across.

I remain curious to learn where the 1 actually occurs.