Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

help with if statement.....

[stupid question alert]

I got this in my load statement.

  left(subfield(FileName(),'Open',2),8) As Test1,

  if(left(subfield(FileName(),'Open',2),8) = 'Changes','CHG','INC') As Test2

  and getting this result...

Capture.PNG

what do I do wrong....

2 Replies
Anonymous
Not applicable
Author

left(subfield(FileName(),'Open',2),8) will return 8 characters, but Changes is only 7 characters. So you'll either need to adjust your Left() to be 7 instead of 8, or adjust 'Changes' to whatever left(subfield(FileName(),'Open',2),8) returns.

sunny_talwar

Try this:

If(Trim(Left(SubField(FileName(),'Open',2),8)) = 'Changes','CHG','INC') As Test2

or

If(WildMatch(Left(SubField(FileName(),'Open',2),8), '*Changes*'),'CHG','INC') As Test2