Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Predefined number series (dropdown) with dynamic max value

I have an input box which provided the user with a drop down with a number series, currently hard-coded 1-12 in the variable settings. I want to be able to change the max value based on another variable/field. 

- I am unable to enter an expression in the "To" field.

- I am also unable to set huge max ie: 1-1000 and then filter which values are visible based on another variable.

Any suggestions?

PredefinedDropdown.jpg

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Instead of the Number Series, check 'Listed Values' and create your own series using an expression:

=concat(ValueLoop(1,100,1),';',ValueLoop(1,100,1))

You can use a variable as upper limit (i.e. replace 100 wiht e.g. $(vUpperLimit).

View solution in original post

15 Replies
maxgro
MVP
MVP

I tkink you can only use expressions in Custom and Error Message because there are the ... (dots)

from online help

CustomInput values will be checked against a user specified constraint. The constraint is entered in the edit box and must be expressed as a QlikView expression returning TRUE (non-zero value) if the input value is acceptable. The input value is referenced as a dollar sign ($) in the expression.

Example:

$>0 will cause the input box to accept only positive numbers in the selected variable.

The previous value of the variable can be referenced by the variable name.

Example:

$>=abc+1 as a constraint on a variable named abc will cause the input box to accept only numeric entries with a value of the old value plus 1.

swuehl
MVP
MVP

Instead of the Number Series, check 'Listed Values' and create your own series using an expression:

=concat(ValueLoop(1,100,1),';',ValueLoop(1,100,1))

You can use a variable as upper limit (i.e. replace 100 wiht e.g. $(vUpperLimit).

Anonymous
Not applicable
Author

this is interesting!

just curious but using the expression in swuehl's post, the input box displays one row - 1;2;3;4;5;6; and so on up to 100. it does not allow to input a single number within 1-100. also, there is no drop down of each number to 100 even if predefined values is selected in drop-down option.

am i missing something?

Not applicable
Author

This is VERY close, but for some reason it is displaying the range on one line instead of as distinct values to be selected individually. Two screen shots below:

First is when I have =concat(ValueLoop(1,100,1),';',ValueLoop(1,100,1))

Second is when I just list "1;2"

PredefinedDropdownUsingConcat.jpg

How can I make it so the concat doesn't result in single sting?

Anonymous
Not applicable
Author

exactly what i was referring to.

a very less cool way of doing it is may be the following. of course, more the number of options you have, less efficient/more cumbersome this will become!

if you only have a couple of options for max, then may be create two variables with their respective max values the way you created it to begin with and have two separate input boxes at the same coordinates on top of each other. use conditional show/hide based on selected option on the input boxes. in other charts, you will have to account for the selection and corresponding variable.

like i said, this may be your very last resort!

edit: or you could do this with inline tables and using fields instead of variables.

swuehl
MVP
MVP

Not sure why this don't work for you, seems to work for me (see attached sample with Variable1 as dropdown, range upper limit determined by Variable2).

Not applicable
Author

Its working as you mentioned in your file when i opened it, but even when i tried to copy the expression and put it in an input box i created it did not work.All the data was in one line.

This is interesting....

Not applicable
Author

Same results for me

swuehl
MVP
MVP

Could you repost your sample application?