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: 
Qlik1_User1
Specialist
Specialist

How to pass dynamic values to selectmatch api

Below script not working when passing dynamic year in mashup (JavaScript section).

app.field('reporting_year').selectMatch('year(today())', true);

Please help on this.

Labels (2)
1 Solution

Accepted Solutions
edwin
Master II
Master II

i believe this will pass the acual string and Qlik wont evaluate it.  you should pass the actual year as determined in your code.  here is one way:

app.field('reporting_year').selectMatch(new Date().getFullYear(), true);

app.field('reporting_year').selectMatch(String(new Date().getFullYear()), true);

 depending on what you want to pass num or string

View solution in original post

3 Replies
edwin
Master II
Master II

i believe this will pass the acual string and Qlik wont evaluate it.  you should pass the actual year as determined in your code.  here is one way:

app.field('reporting_year').selectMatch(new Date().getFullYear(), true);

app.field('reporting_year').selectMatch(String(new Date().getFullYear()), true);

 depending on what you want to pass num or string

Qlik1_User1
Specialist
Specialist
Author

Thanks @edwin , Below script worked.

app.field('reporting_year').selectMatch(String(new Date().getFullYear()), true);
edwin
Master II
Master II

np