Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Panv
Contributor II
Contributor II

if statement error upon loading app script

my if statement is failing, but I'm not sure why

Here is my statement:

if(Single_asset_only_assigned + Single_asset_only_derived = 1, 
    if(len(asset_class_assigned)>0, asset_class_assigned, asset_class_derived),
    if(Single_asset_only_assigned + Single_asset_only_derived = 2, 
        if(Single_asset_only_assigned = Single_asset_only_derived, asset_class_assigned,'')
    ,'')
) as "combo.Name of all asset classes"


the second "if" is highlighted in red but I cant seem to find anything wrong with the statement.

getting the following message when script runs:

The following error occurred:
Unexpected token: 'if', expected one of: ',', 'Inline', 'AutoGenerate', 'From', 'From_Field', 'Resident', 'Extension', ...
The error occurred here:
combo:
Load Distinct
*
>>>>>>if<<<<<<(combo.Single_asset_only_assigned + combo.Single_asset_only_derived = 1, if(len(combo.asset_class_assigned)>0, combo.asset_class_assigned, combo.asset_class_derived),
if(combo.Single_asset_only_assigned + combo.Single_asset_only_derived = 2, if(combo.Single_asset_only_assigned = combo.Single_asset_only_derived, combo.asset_class_assigned,''),'')) as "combo.Name of all asset classes"
Resident combo_temp


Any ideas?

2 Replies
Don_Stocks_
Contributor III
Contributor III

From the error message, it looks like you have an asterisk after the Load Distinct statement. If you remove it does that resolve the error?

Don Stocks
Kushal_Chawda

@Panv  Put "," after "*"

combo:
Load Distinct
*,
>>>>>>if