Qlik Community

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
kishore3k
Partner
Partner

Issue in SelectValues Field API when the field is Date format

Hi ,

Just to provide you background - We have multiple qlik apps opened in our web application and when the user makes the selections in primary app - we apply the common selection across all the apps opened. We have this strange issue with fields that are tagged as Date in the datamodel. Please check below example.

Version : June 2020 Patch 7 v13.82.15

I have issue with selectValues Field API when the field is in Date format.

Scenario 1 - Field : Month_Year is date datatype:

Let say, I have val array in which I have selected values of the date type field "Month_Year".

var valArray[]= {
0:"Jan 2020"
1:"Feb 2020"
2:"Mar 2020"
}

Var FieldName = "Month_Year";  // field in datamodel script :  Date#(Month_Year,'MMM YYYY') AS Month_Year

app.Field(FieldName ).selectValues(valArray);

it is not selecting the value in desired "app" because the FieldName = Month_Year is derived as Date#(Month_Year,'MMM YYYY').

Scenario 2 - Field : Month_Year is TEXT() string datatype:

Let say, I have val array in which I have selected values of the text/string type field "Month_Year".

Var FieldName = "Month_Year";  // field in datamodel script :  Text(Month_Year) AS Month_Year

var valArray[]= {
0:"Jan 2020"
1:"Feb 2020"
2:"Mar 2020"
}

app.Field(FieldName ).selectValues(valArray);

Now the same field is making the selections in the field if we bring the field as text(Month_Year) as Month_Year.

did anyone faced this issue in your mash up application? do we have any solutions?

@Bastien_Laugiero , @Michael_Tarallo  , @ToniKautto , @ian_wilson , @Patric_Nordstrom @ChristofSchwarz @Anonymous 

 

 

 

 

 

                         

Labels (6)
1 Solution

Accepted Solutions
kishore3k
Partner
Partner
Author

Hi All

Seems like select Values API will accept string/numeric and date is being converted to Number by default in Qlik.

We did a workaround to convert these fields as text and sorting them using another date field in the application.

Hope this helps!

Thanks,

Kishore.

View solution in original post

3 Replies
Prashant_N
Contributor III
Contributor III

Hi Kishore,

Try to use selectMatch function instead of selectValues.

Might help you.

Regards,

Prashant

kishore3k
Partner
Partner
Author

Hi Prashant,

Thank for you suggestion!

I have checked it and didn't seem to work there as well. I will check this  again and keep you posted. 

Meanwhile have you worked on passing multiple values as array to selectMatch API ? If yes can you please post an example? My guess is that selectMatch we need to pass the array of selections different to the selectValues (My above code is working for single/multiselections except if the field is tagged as Date)

Also if you look into this thread - dynamic multi values seems like not possible. https://community.qlik.com/t5/Qlik-Sense-Integration-Extensions-APIs/selectMatch-for-more-than-one-v... 

kishore3k
Partner
Partner
Author

Hi All

Seems like select Values API will accept string/numeric and date is being converted to Number by default in Qlik.

We did a workaround to convert these fields as text and sorting them using another date field in the application.

Hope this helps!

Thanks,

Kishore.

View solution in original post