Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Please mark it as accepted solution, if you are satisfied.
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),
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
Please mark it as accepted solution, if you are satisfied.