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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How I can receive max and min values from the list of the chosen values in Sub?

Hi!

I tried:

vPointStart = MIN(ActiveDocument.fields("Field").GetSelectedValues)

vPointEnd = MAX(ActiveDocument.fields("Field").GetSelectedValues)



I receive: mismatch of type MIN

How I can receive max and min values from the list of the chosen values in Sub?

thx

3 Replies
Not applicable
Author

Hi,

I don't know why this is not working.

But I can suggest to use script:


sub test

set vVariable = ActiveDocument.fields("Time").GetSelectedValues
for i = 0 to vVariable.Count-1
'msgbox(vVariable.Item(i).text)
if vMax < vVariable.Item(i).text then vMax = vVariable.Item(i).text
if vMin > vVariable.Item(i).text then vMin = vVariable.Item(i).text
next

msgbox(vMax)
msgbox(vMin)


end sub


Not applicable
Author

Hey!!

Did You try it? Is it works?

Not applicable
Author

You should sort your values before setting minimum and maximum values.

Please refer to below:

OrderedDatesTable:

LOAD TARIH RESIDENT EXCEL1 ORDER BY TARIH ASC;
LET varMinDate = Num(Peek('TARIH', 0, 'OrderedDatesTable'));
LET varMaxDate = Num(Peek('TARIH', -1, 'OrderedDatesTable'));