Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

selectMatch() for more than one value

Does anyone have experience using the selectMatch() function for selecting more than one value in a Qlik Sense mashup?

I want to select more that one year and I've tired these statements without any luck:

app.field("[Year]").selectMatch("20102011", false);

app.field("[Year]").selectMatch("2010 2011", false);

app.field("[Year]").selectMatch("2010|2011", false);

app.field("[Year]").selectMatch("2010,2011", false);

Thanks in advance.

/Thomas

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

SelectMatch performs a field search so normal search syntax in QS applies. In your case it would look like,

app.field("[Year]").selectMatch("2010 or 2011", false);

But I would recommend that you use app.field.selectValues instead which takes an array of either ElemNumbers or strings. In your case it would be something like,


app.field("[Year]").selectValues([{qText: '2010'}, {qText: '2011'}], true, true);

View solution in original post

5 Replies
Alexander_Thor
Employee
Employee

SelectMatch performs a field search so normal search syntax in QS applies. In your case it would look like,

app.field("[Year]").selectMatch("2010 or 2011", false);

But I would recommend that you use app.field.selectValues instead which takes an array of either ElemNumbers or strings. In your case it would be something like,


app.field("[Year]").selectValues([{qText: '2010'}, {qText: '2011'}], true, true);

Alexander_Thor
Employee
Employee

ops the search syntax for selectMatch should probably be more closer to app.field("[Year]").selectMatch("=[Year] = '2010' OR [Year] = '2011'")

Not applicable
Author

Thanks Alexander

I gave up on the SelectMatch and went with the SelectValues instead.

Best regards

Thomas

Tooor
Contributor II
Contributor II

... or selectMatch(">=2010<=2011")

... or selectMatch('=MyVariable'), where MyVariable has the following definition: ='">=$(=date(vMyDate))"'