Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Black_Hole
Creator II
Creator II

Problem with IF statement in Load

Hello all,

In my script, I write an IF statement and I save the result in a new column.

But I don't understand why after to run the script I get none value for the column created.

  • Below my script:

AMOUNT:
LOAD *,
IF(LEN(Type)=0,Credit,Debit) as test
RESIDENT JOURNAL;

  • Below the result:

00.PNG

Please could you help me to resolve this problem.

Thank you in advance for your help.

Labels (4)
4 Replies
neelamsaroha157
Specialist II
Specialist II

Can you add a new column as  LEN(Type) just to check the values you for the newly added column.

Brett_Bleess
Former Employee
Former Employee

Only other thing that came to mind for me was if you aliased Type in the original load statement and are using the original field name not the alias?  Highly unlikely, but I wanted to toss it out there just in case.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
nicolas66
Contributor III
Contributor III

Bonjour,

If(LEN('Type')=0, 'Credit', 'Debit') as test 

... perhaps ?

Berndtssono
Contributor
Contributor

if(len(Type)='0', Credit, Debit) as test

maybe like that