Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm new to QlikSense and can't figure out the right syntax to get the all selected values in extensions.
Below is my code of extensions.
define( ['qlik', 'jquery', 'css!./select_field.css'],
function (qlik, $) {
return {
paint: function ($element) {
var app = qlik.currApp();
app.getList("CurrentSelections", function(reply) {
var mySelectedFields = reply.qSelectionObject.qSelections;
//console.log(mySelectedFields);
if (mySelectedFields.qLocked == true)
{
icon = 'unlock'
}
else
{
icon = 'lock';
}
var html = '<div class="bgShowSelection">';
if (mySelectedFields.qLocked == true)
{
html += '<button id="lock_button" class="btn-lock-unlock"><p class="lui-icon lui-icon--lock"></p></button>'
}
else
{
html += '<button id="unlock_button" class="btn-lock-unlock"><p class="lui-icon lui-icon--unlock"></p></button>'
html += '<button id="clearAll" class="btn-lock-unlock"><p class="lui-icon lui-icon--clear-selections"></p></button>';
}
//loop through selected fields
var mySelectedFields_arrayLength = mySelectedFields.length;
for (var i = 0; i < mySelectedFields_arrayLength; i++) {
//console.log(mySelectedFields[i].qSelected);
//loop through selected field values
var currentFieldValues = mySelectedFields[i].qSelectedFieldSelectionInfo
var currentFieldValues_arrayLength = currentFieldValues.length;
if (mySelectedFields.qLocked == true)
{
lockUnlock = 'bgShowSelectionsLock'
}
else
{
lockUnlock = 'bgShowSelectionsUnlock';
}
for (var y = 0; y < currentFieldValues_arrayLength; y++)
{
html += '<span id="selectedvalue" class="no_selected '+lockUnlock+'" title="'+mySelectedFields[i].qField+'">'+currentFieldValues[y].qName+'<input type="submit" value="x" class="btndelete" style="font-size : 10px;"/></span>';
}
}
html += '</div>';
$element.html(html);
});
return qlik.Promise.resolve();
}
};
}
);
I can select the value here in my code but it only display maximum of 6 values per filter pane.
Sample of my extensions below, I select more than 6 values on report period filter but on my extension it only display 6 values, can some one help me to display all selected.
Can anybody help me with the right code syntax?
Hi @jenriquez ,
I'm also new to Qlik sense but i think you need to set qInitialproperties and qInitialDataFetch. Refer the link below, you need to set qWidth and qHeight.
Hi @jenriquez
I tried your extension code (after commenting out your css file) and it was showing me a maximum of 6 selections per field, after that it switched to a different way to show the selection, I added the following console.log to your code:
Then I found a reference to qSelectionThreshold in the qFieldSelections Qlik Help document, also this community topic speaks about the Selection Threshold Sense extensions : How can I change qSelectionThreshold value ? ; I tried configuration suggested in my Setting.ini file, and it works!
It works, but I suspect it might not be enough for your proyect.
Hope this helps,
yup, its not enough for the requirements of my project, thanks by the way. 😊
hi @Manoj_Prabu
hmmm, still getting 6 values even I set qInitialproperties and qInitialDataFetch.
var initialParameters = {'qWidth':1, 'qHeight':10000};
return {
support : {
snapshot: true,
export: true,
exportData : false
},
initialProperties: {
qListObjectDef: {
qInitialDataFetch: [{
qWidth: initialParameters['qWidth'],
qHeight: initialParameters['qHeight']
}]
},
},
hi can somebody help me with the right code syntax to get all the selected values with no maximum limit? thanks in advance.
Hi @jenriquez ,
Did you tried with HyperCube? like below...
initialProperties : {
qHyperCubeDef : {
qDimensions : [],
qMeasures : [],
qInitialDataFetch : [{
qWidth : 2,
qHeight : 50
}]
}
}
hi @Manoj_Prabu
yup, I also tried the HyperCube. But still cant work to display all the selected values
Hi @jenriquez ,
I couldn't able to find whats the problem. but also check this.
in 1st I selected only 2 values in city field, so i get only 2 trellis chart even though i gave 10 in fixed number.
In 2nd i chose 4 value so it showing 4 trellis chart.
in the last i chose 4 city but i give only 3 in the fixed number(which act as initialfetchdata). so im getting 3 trellis chart.
may be you check other fields like city in your app that you chose only 6 field values (or 6 cities).
Thank you.
hi @Manoj_Prabu
can you share your extension? TIA.