Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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));
going through that link shows you how to create a hypecube and does some explaining.
once you get that, a faster way to code is to select your application in DEVhub:
click add hypercube:
then choose your dimensions and measures. it will create the code for you and you can just move that piece of code anywhere you want
GetSelectedCount is a function in Qlik Sense not in javascript. you are mixing up the syntax of Qlik Sense expressions and javascript:
Qlik Sense: if(condition, true, false)
javascript: if (condition)
{true}
else
{false}
it looks like you want to know if there are selected values for reporting year - unfortunately, you need to get that info via api. a hypercube may be usefull. wouldnt you want your webpage to know not just if there are selected rep years but also what was selected and all possible selections? that can be retrieved via hypercube
@edwin can you please help in creation of a hypercube , I am new to mashup, i am not aware how to achieve this.
go through this:
https://help.qlik.com/en-US/sense-developer/May2022/Subsystems/APIs/Content/Sense_ClientAPIs/Capabil...
it shows you how to create hypercubes. this allows you to get data from your dashboard - almost like a straight table. you can use rep year as your dimension and just create measures to tell you which ones are selected.
going through that link shows you how to create a hypecube and does some explaining.
once you get that, a faster way to code is to select your application in DEVhub:
click add hypercube:
then choose your dimensions and measures. it will create the code for you and you can just move that piece of code anywhere you want
hypercubes are returned as promises. you may also want to read up on that:
JavaScript Promises: an introduction (web.dev)