Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

which method can be used for selecting values in multiple dimensions in extensions ???

Hi everyone,

I have been developing qliksense extensions for some time. In one of the extensions its required to select multiple values from multiple dimensions and apply as filters from the chart.

Issue is one dimension values can be filtered using method :

1. self.backendApi.selectValues(dim, [value], true);

or

2. self.selectValues(dim, [value], true);

But is there any method available or any technique that can be used which can apply filters to multiple dimensions at the same time, and then repaint the chart.

Thanks.

4 Replies
ErikWetterberg

Hi Ashish,

You could use the mashup API and the field methods. To do that you need to reference the mashup API in the define at the beginning of the extension:

define(["qlik"], function(qlik) {

....

});

You can then use the mashup API in your code:

var app = qlik.currApp(this);

app.field('LastName').selectValues([{qText:'Obama'},{qText:"Bush"}], true, true);

           

Hope this helps

/Erik

diogoguilhen
Contributor III
Contributor III

And how i can construct this in JS?

[{qText:'Obama'},{qText:"Bush"}]

diogoguilhen
Contributor III
Contributor III

I GOT IT!

Follow :

var formatter = new Intl.DateTimeFormat("pt-BR", { month: "short" }),

  month1 = formatter.format(new Date()) ;

  var monthNames = ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'];

  var posicao = monthNames.indexOf(month1);

  var mesesSelecionados = monthNames.slice(posicao, 12);

app1.field('[messtr]').selectValues( mesesSelecionados, true );

I just use a simple array!!!!! and select another dimension.

srilakshmi_as
Creator
Creator

diogoguilhen,

Super, thankyou

(works perfectly for Single dimension,multiple values passing to selectValues)