Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik1_User1
Specialist
Specialist

How To pass values in field based on condition in selectMatch api

Hi All,

I am using below API to pass a value in field
app.field('reporting_year').selectMatch(String(new Date().getFullYear()), true)


Is it possible ,if user has already selected a value in "reporting_year" field than pass user selected year else current year (2022)


Using this but  its not working in mashup
if(GetSelectedCount('reporting_year')=0,app.field('reporting_year').selectMatch(String(new Date().getFullYear()), true));

Labels (2)
1 Solution

Accepted Solutions
rbartley
Specialist II
Specialist II

It also appears that this is a duplicate of this post : https://community.qlik.com/t5/App-Development/How-To-pass-values-in-field-based-on-condition-in-sele... , which @edwin has already responded to in the same way as my reply above.  If you've never created a mashup before, I would suggest you look at https://qlik.dev/ and https://extendingqlik.upper88.com/ 

View solution in original post

2 Replies
rbartley
Specialist II
Specialist II

Hi @Qlik1_User1 ,

It's not clear from your post which API you are using and how.  GetSelectedCount() is a chart function, not an API function (unless you have written your own JS function called GetSelectedCount()), and the two cannot be mixed.  In your mashup, you would need to use the selection  object to find whether a field has been selected, then use this in your code.

 

rbartley
Specialist II
Specialist II

It also appears that this is a duplicate of this post : https://community.qlik.com/t5/App-Development/How-To-pass-values-in-field-based-on-condition-in-sele... , which @edwin has already responded to in the same way as my reply above.  If you've never created a mashup before, I would suggest you look at https://qlik.dev/ and https://extendingqlik.upper88.com/