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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
gouthamkk
Creator
Creator

Variable value

Hi Experts,

In the backend scripting, I would like to get count of distinct id into a variable. Can some one help me in getting it?

Eg:

Load Count(distinct(id)  as flag;

sql select * from demo;

Till here every thing is fine.

No I need to save the flag values in a variable

Request to assist

Thanks Kumar

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Load Count(distinct(id)  as flag;

sql select * from demo;

LET vCount = peek('flag');

But you don't need to do it this way. Qlikview keeps track of distinct values of its internal tables and there are (very fast) functions to use such information:

sql select * from demo; // this assumes you load a field called id.

LET vCount = fieldvaluecount('id'); // get the number of distinct values from Qlikviews internal field tables.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Load Count(distinct(id)  as flag;

sql select * from demo;

LET vCount = peek('flag');

But you don't need to do it this way. Qlikview keeps track of distinct values of its internal tables and there are (very fast) functions to use such information:

sql select * from demo; // this assumes you load a field called id.

LET vCount = fieldvaluecount('id'); // get the number of distinct values from Qlikviews internal field tables.


talk is cheap, supply exceeds demand
gouthamkk
Creator
Creator
Author

HI,

Thanks a lot for the additional input. I think I will go with your second thought on Internal tables. Both the logics works fine and are giving same results

thanks

Kumar