Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
below is the sample table
CAL:
Load * INLINE [
days,no
Jan,1
Feb,1
Mar,3
Apr,2
May,4
Jun,4
Jul,5
Aug,6
Sep,7
Oct,8
Nov,9
Dec,5
];
i want to get thhe distinct count of column "no"
at script level i am using
let vvar = count(DISTINCT no);
trace >>> countof: $(vvar);
but log file show null
plz provide any solution for the same the required answer should be "9"
Try this way
CAL:
LOAD * INLINE [
days, no
Jan, 1
Feb, 1
Mar, 3
Apr, 2
May, 4
Jun, 4
Jul, 5
Aug, 6
Sep, 7
Oct, 8
Nov, 9
Dec, 5
];
//Add this table for distinct count
Cnt:
LOAD
count(DISTINCT no) as No
Resident CAL;
let vvar = Peek('No',0,'Cnt'); //And store in this variable
trace >>> countof: $(vvar);
Regards
Try this way
CAL:
LOAD * INLINE [
days, no
Jan, 1
Feb, 1
Mar, 3
Apr, 2
May, 4
Jun, 4
Jul, 5
Aug, 6
Sep, 7
Oct, 8
Nov, 9
Dec, 5
];
//Add this table for distinct count
Cnt:
LOAD
count(DISTINCT no) as No
Resident CAL;
let vvar = Peek('No',0,'Cnt'); //And store in this variable
trace >>> countof: $(vvar);
Regards
why we need to create a new table (i.e Cnt)?, why it is not possible with "count" command directly
You can easily get this done in the UI.
For script just Anand has provided a sample solution.
If manually you create the variable in the front end then you can easily achieve with expression
vvar = count(DISTINCT no);
But in load script you have to refer the table directly.
That is from UI