I have a multiple html pages mashup but i having problem to preserve current selection between html pages.
Thus, i tried to using browser sessionstorage method to store current selection made in page A then retrieve the selection from sessionstorage in page B and using selectValues api to perform pre-select.
I able to selectValues() for interger and text but i having problem to use selectValues for selecting date.
Kindly advice how can select date using selectValues.
app.field('customer_name').selectValues(["Peter"], true, true) -> working
app.field('year').selectValues(, true, true) -> working
app.field('date').selectValues(['1/7/2013'], true, true) -> not working
You need to make sure you use the same format as in your app. And remember the display format can be different than the data format on the field level. So look into your datamodel what format your using, and use the same.
Otherwise use the date as a number when it passed. And make sure that the date field has no timestamp in it.
If you want to be sure then format your date like: date(floor(datefield),"d/m/yyyy") as date then your code should work.
Field API selectValues() method allows either string or numeric values in the array. However, for dates you must use the numeric value of the given date. Check how Qlik converts date values in the documentation here.
Then, the equivalent call of
in 'MM/DD/YYYY' format. You can check the numeric value using the Num(Date(my_date)) Qlik's function.
All you gotta do now is re-create the same conversion from Qlik to your Mashup qlikDateStringToNum().