Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
JustinDallas
Specialist III
Specialist III

LET variable, evaluate with braces

Hello Folks,

I'm trying to set a simple variable in my script.  Right now, it looks like so:

LET vHasLastShift = COUNT({<IsLastShift={'*'}-{''}>}[Stop Number]);

Currently, the problem is that the script editor isn't taking too kindly to my braces, '{'.  Does anyone know how to get this calculation done in my script?  I need this calc in the script because it will be used as a condition for NPrinting.

Any help is greatly appreciated.

1 Solution

Accepted Solutions
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Dustin,

The way your making it only works for charts, set expression is available for charts only.

Link for chart:

http://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/ChartFunctions/CounterAggregat...

Link for script count aggregation:

Count - função de script ‒ Qlik Sense

What you can do on script side is something like:

// Your first data load

Data:

Load

     *

From [Whatever];

// Count table:

tmp:

Load

     count([Stop Number]) as CountStopNumber

Resident Data

where len(IsLastShiftIsLastShift) > 0;


// gets the count from the previously loaded table

let vHasLastShift  = peek('CountStopNumber',0,'tmp');


drop table tmp;


hope it helps;

View solution in original post

3 Replies
MK9885
Master II
Master II

  1. LET vHasLastShift = 'COUNT({<IsLastShiftIsLastShift={'*'}-{''}>}[Stop Number])'
JustinDallas
Specialist III
Specialist III
Author

The problem is that my Set Restriction has single-quotes itself, and it doesn't like those as that "ends" my statement.

felipedl
Partner - Specialist III
Partner - Specialist III

Hi Dustin,

The way your making it only works for charts, set expression is available for charts only.

Link for chart:

http://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/ChartFunctions/CounterAggregat...

Link for script count aggregation:

Count - função de script ‒ Qlik Sense

What you can do on script side is something like:

// Your first data load

Data:

Load

     *

From [Whatever];

// Count table:

tmp:

Load

     count([Stop Number]) as CountStopNumber

Resident Data

where len(IsLastShiftIsLastShift) > 0;


// gets the count from the previously loaded table

let vHasLastShift  = peek('CountStopNumber',0,'tmp');


drop table tmp;


hope it helps;