Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Cases 848 if(@241:248T = '2',@134:147T*-1,@134:147T) as [sales]

Hi All

I have below load script working fine , But it only load SOURCE = TS , iT Unable load SOURCE = TI  sales :-

For Each i in 'TS','TI'
SALES_TDS:
LOAD left(FileBaseName(), 4) AS Report_dod_1,
'$(i)' as SOURCE,
if(@241:248T = '2',@134:147T*-1,@134:147T) as [sales]
FROM $(vRAWPath)SO_$(i).TXT (ansi, fix, no labels, header is 0, record is line);
NEXT i;

I like to add the condition :-

If load script that work for SOURCE = TS

if(@241:248T = '2',@134:147T*-1,@134:147T) as [sales],

If load script that work for SOURCE = TI

if(@241:248T = '2',@137:151T*-1,@137:151T) as [sales],

I have try :-

For Each i in 'TS','TI'
SALES_TDS:
LOAD left(FileBaseName(), 4) AS Report_dod_1,
'$(i)' as SOURCE,
if('$(i)'=TS,if(@241:248T = '2',@134:147T*-1,@134:147T),
if('$(i)'=TI,if(@241:248T = '2',@137:151T*-1,@137:151T),
)) as [sales_]
FROM $(vRAWPath)SO_$(i).TXT (ansi, fix, no labels, header is 0, record is line);
NEXT i;

i GET error msg :-

Field not found - <TS>

Hope some one can help me.

Paul Yeo

1 Solution

Accepted Solutions
Saravanan_Desingh

Please mark it as accepted solution, if you are satisfied.

View solution in original post

4 Replies
Saravanan_Desingh

Hey. If TS or TI is a String, it should be enclosed with quote. Can you please check like..

if('$(i)'='TS',if(@241:248T = '2',@134:147T*-1,@134:147T),
if('$(i)'='TI',if(@241:248T = '2',@137:151T*-1,@137:151T),
if($(i)='TS',if(@241:248T = '2',@134:147T*-1,@134:147T),
if($(i)='TI',if(@241:248T = '2',@137:151T*-1,@137:151T),

 

paulyeo11
Master
Master
Author

Hi saran

Thank you very much for your help. Now it work.

Your first expression work and second expression get error msg on TS not found.

Paul

Saravanan_Desingh

Please mark it as accepted solution, if you are satisfied.