Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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.
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