Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
Recently I have this issue about deselection using selectValues when selection is invalid.
Assuming my extension has 2 dimensions (Zip Code, Building Name)
Let's assume some data too:
Zip Code | Building Name |
---|---|
11111 | AAA |
11111 | BBB |
11111 | CCC |
22222 | DDD |
22222 | EEE |
Suppose the user current selection is:
Zip Code: 11111
Building Name: AAA, BBB, CCC
What I does is to programmatically select the rest of the data:
app.field('Zip Code').selectValues([22222], true, true);
app.field('Building Name').selectValues(['DDD', 'EEE'], true, true);
Then programmatically deselect the rest of the data:
app.field('Zip Code').selectValues([22222], true, true);
app.field('Building Name').selectValues(['DDD', 'EEE'], true, true);
The result would be Building Name selection unable to deselect because the deselection of Zip Code has render the current 'DDD' and 'EEE' to be gray out in the selection bar. Repeatedly calling
app.field('Building Name').selectValues(['DDD', 'EEE'], true, true);
has no effect unless I select back Zip Code 22222 to "enable" the Building Name "DDD", "EEE".
Do you guys have any workaround or even better, the correct way to deselect even when the selection is gray out?
I think you need an unique ID for each selectable marker to make this work. Say for example that the user select
Or another example, the user selects
If the data now contains also 1111, BBB and/or 2222, AAA they will also be selected.
If you instead used a unique id (possibly concatenation of zip + building) you can use just that field for selection and the associative logic will fix the rest.
I hope I have not misunderstood everything...
Erik
Why don't you use app.field('Building Name').clear() ?? Or possibly use app.field('Building Name').selectExcluded() ??
Erik
Yup, that's exactly what I have done finally but it does require several code changes to use the clear method.
Previously:
1) Get the current selection from custom extension object
2) Append current selection to qlik selection bar
Currently:
1) Get the current selection from qlik selection bar
2) Get the current selection from custom extenstion object
3) Clear current selection from qlik selection bar
4) Combine #1 and #2 selections together
5) Append #4 selections to qlik selection bar
I'm afraid I don't understand what you are trying to do.
Your first step is selecting the rest of the data (selectAlternative ??). Does that work as expected?
Then you want to go back to the initial selection? Is that what does not work??
Erik
Hmm basically I'm doing a map extension.
User is able to select plotted markers on the map.
When selecting a plotted markers, based on the marker attributes, I will make a selection via selectValues to qlik side.
So for example user now click on a train station in USA, user will see Zip Code 111 and Product ID AAA at qlik selection bar.
If user now decided to deselect the marker, system should remove the Zip Code 111 and Product ID AAA at qlik selection bar which is perfectly ok now since there is no other selection.
However if user make another selection 1st before deselecting, say for example another bus station in Canada, user will see Zip Code 111, 999 and Product ID AAA, FFF at qlik selection bar.
If user now decided to deselect the marker at USA, system should remove the Zip Code 111 and Product ID AAA at qlik selection bar so that only Zip Code 999 and Product ID FFF remains.
However this will not work as after executing the following, the value for Product ID AAA will be gray out:
app.field("Postal Code").selectValues("111", false, true);
Subsequently executing the following to deselect Product ID AAA will not cause any effect in the selection bar.
app.field("Product ID").selectValues("AAA", false, true);
I think you need an unique ID for each selectable marker to make this work. Say for example that the user select
Or another example, the user selects
If the data now contains also 1111, BBB and/or 2222, AAA they will also be selected.
If you instead used a unique id (possibly concatenation of zip + building) you can use just that field for selection and the associative logic will fix the rest.
I hope I have not misunderstood everything...
Erik
Hmm for your 1st scenario,
No, zip 1111 and building BBB will be selected finally.
For your 2nd scenario,
If the data now contains also 1111, BBB and/or 2222, AAA they will also be selected.
It's not possible because if the qlik selection bar already contains 1111, BBB and/or 2222, then at the map side, those markers would already be selected so subsequent selection of them will only cause deselection instead.
Finally yes I implemented with your unique id strategy and got over the hurdle, thanks a lot Erik!