Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
seraphis
Contributor III
Contributor III

Error in If Condition

I see the red coloured part in the code below highlighted in red in Qliksense also and this code does not execute.

I am trying to create a new table taking all fields from another table Case1 and also create a new field called AssetFlag. 

Case4:

Load *,
if Case_Flat_Case.Asset_Serial_Number <> Previous(Case_Flat_Case.Asset_Serial_Number) then
AssetFlag = "Yes";
end if
Resident Case1
order by Case_Flat_Case.Asset_Serial_Number,Case_Flat_Case.Date_Time_Opened asc;

Labels (1)
2 Replies
Gysbert_Wassenaar

Inside a load statement you have to use the If function not the If script statement

If(Case_Flat_Case.Asset_Serial_Number <> Previous(Case_Flat_Case.Asset_Serial_Number ), 'Yes', 'No') as AssetFlag

Note, the 'No' is optional. If you don't supply the third argument to the if function it will return Null if the condition in the first argument evaluates to false.


talk is cheap, supply exceeds demand
seraphis
Contributor III
Contributor III
Author

Thanks. It works!