Trim not working in else clause
Posted: Mon Mar 20, 2017 2:45 pm
Hi,
Below is what I am implemented in datastage
COALESCE(trim(field),'-1')
I am using If clause where I check for empty string and put -1 else trim the field.
If I use TrimLeadingTrailing(NulltoValue(field,-1)) I am getting an error while compilation saying that a composite call is not allowed.
Hence i am using If then else clause as below :
If TrimLeadingTraling(field)='' then -1 else TrimLeadingTrailing(field) ---
the issue with the above is that the part in the else clause is not functioning. The -1 is getting populated fine for a null but the trim part is not happening for not null fields. I have tried putting in stage variables and also used stripwhitespace and trim instead of Trimleadingtrailing. None is working.
Please advice.
Below is what I am implemented in datastage
COALESCE(trim(field),'-1')
I am using If clause where I check for empty string and put -1 else trim the field.
If I use TrimLeadingTrailing(NulltoValue(field,-1)) I am getting an error while compilation saying that a composite call is not allowed.
Hence i am using If then else clause as below :
If TrimLeadingTraling(field)='' then -1 else TrimLeadingTrailing(field) ---
the issue with the above is that the part in the else clause is not functioning. The -1 is getting populated fine for a null but the trim part is not happening for not null fields. I have tried putting in stage variables and also used stripwhitespace and trim instead of Trimleadingtrailing. None is working.
Please advice.