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

Script load error in qliksense

Hi,

i have a expression  as shown below

sum({$<CanonicalDate = {"$(='>=' & Date(MonthStart(Max(CanonicalDate ))) & '<=' & Date(Max(CanonicalDate)))"},

client_name = {'Parlegi'},final_test_status={'passed'}>} course_completed)

Now i am loading above expression in script as shown below

Let val = 'sum({$<CanonicalDate = {"$' &'(='>=' & Date(MonthStart(Max(CanonicalDate ))) & '<=' & Date(Max(CanonicalDate)))"},

client_name = {''Parlegi''},final_test_status={''passed''}>} course_completed)';

But while loading it gives me error.

What is wrong i am doing in script, to load expression.

4 Replies
prashanth1712
Contributor III
Contributor III

Hi,

I think you cannot perform set analysis in script.

Instead do one thing, take the resident of the dimensions you are calculating on do summation in the resident table and try grouping.

Ex:

TmpTable:

Load

CanonicalDate ,

client_name ,

final_test_status,

if(CanonicalDate <= max(CanonicalDate ), sum(course_completed))  as course_completed


resident MainTable

group by

CanonicalDate ,

client_name ,

final_test_status

;

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Try this.

Let val = 'sum({$<CanonicalDate = {">=$(=Date(MonthStart(Max(CanonicalDate ))) <= Date(Max(CanonicalDate)))"},

client_name = {''Parlegi''},final_test_status={''passed''}>} course_completed)';

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
TKendrick20
Partner - Specialist
Partner - Specialist

This may be better suited for a Variable defined outside of the data load editor.

The Let command expects whatever is after the = sign to be an expression which can be evaluated, but you are passing it a string. If you were to use the Set command, it expects a string after the = sign, which it will assign to the variable. First suggestion is to test in your application that the expression actually works. Then remove the single quotes (') from around the expression in the Let statement. Finally, if all else fails, define the variable in the application outside of the data load editor (because it may not allow set analysis in the data load editor.

TKendrick20
Partner - Specialist
Partner - Specialist

This person posted a very similar question. Though no explanation on how it works...

Variable in load editor with Set analysis expression