Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

Set current selections by date

Hi guys,

I am not able to filter in my mashup by date through javascript. I've tried several solutions

app.field ("YYYYMM"). selectValues (["2011-01"], true, true);

app.field("YYYYMM").selectValues(["40544"],true, true);

app.field("YYYYMM").selectValues(["2012-May"],true, true);

app.field("YYYYMM.autoCalendar.YearMonth").selectValues(["2012-May"], true, true); 

app.field("YYYYMM.autoCalendar.YearMonth").selectValues(["40544"],true, true);

app.field("YYYYMM.autoCalendar.YearMonth").selectValues(["2011-01"],true, true);

app.field("=Dual(Year([YYYYMM])&'-'&Month([YYYYMM]),MonthStart([YYYYMM]))").selectValues(["2012-May"], true, true);

app.field("=Dual(Year([YYYYMM])&'-'&Month([YYYYMM]),MonthStart([YYYYMM]))").selectValues(["40544"], true, true);

app.field("=Dual(Year([YYYYMM])&'-'&Month([YYYYMM]),MonthStart([YYYYMM]))").selectValues(["2011-01"], true, true);

Manually in chart working very well:



Log CurrentSelectionsList:


Tags (1)
2 Replies
Valued Contributor

Re: Set current selections by date

Working with this myself and I found selecting date as a number seems to work. (remove the quotes):

      app.field("YYYYMM.autoCalendar.YearMonth").selectValues([40544],true, true);


Re: Set current selections by date

According to the help site: "Dual() combines a number and a string into a single record, such that the number representation of the record can be used for sorting and calculation purposes, while the string value can be used for display purposes." Therefore it is limited on selecting the text representation of the DUAL field.

Instead of using selectValues() and selecting on the numeric values of the field like David said, you could use selectMatch() method, and provide the text values you want to selected in a seach syntaxt.

e.g. app.field('DayOfWeek').selectMatch('(Monday|Tuesday|Wednesday)', true);

You can also use toggleSelect() method for toggling your selection.

Please mark this answer to be helpful and close the thread if it works for you.

Community Browser