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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
tartik
Contributor
Contributor

Multiple Parameter Values In Variable

I'm trying to use multiple values for a parameter within a variable, and would like to know firstly if this is possible, and secondly how to do it.

I have variable v.Example (obviously I am using proxies as I can't show my details)

Sum({< Category1 = {"$1"},
Category2 = {"$2"}>}
Amount)/1000))

Category1 can take the following values up, down, left, right

Category2 can take the following values peppermint, topspin, Cthulu -

So if I'm looking for say Category1 to be down, and Category2 to be Cthulu, I would now write

$(v.Example(down, Cthulu))

I would like to be able to select more than one value for each parameter, so I would like to use something similar to the below.

$(v.Example(down, [peppermint, Cthulu]))

Can someone please help out with the correct syntax?

Cheers

Labels (2)
4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Unfortunately you can't include a comma as a value. Best workaround is to use a proxy character and then replace() the proxy char with comma in the variable expression. 

-Rob

vincent_ardiet_
Specialist
Specialist

Or quick and dirty solution, if you have a limited number of values to pass optionally:
Sum({< Category1 = {"$1"},
Category2 = {"$2","$3","$4"}>}
Amount)/1000))

$(v.Example(down, Cthulu)) will work
$(v.Example(down, Cthulu, peppermint)) or $(v.Example(down, Cthulu, peppermint, onelast)) too

marcus_sommer

In your scenario it's possible to query multiple field-values because you could change the calling-syntax to:

$(v.Example(down, (peppermint|Cthulu)))

which avoids the commas.

nanda015
Contributor
Contributor

Base your function parameters upon what is most likely to change between different invocation configurations. If you expect to have a set of optional parameters and one or two consistent parameters then order accordingly.