Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
rathodniky
Contributor

Select 2 values in a Field using Macro/ Trigger

Hi All,

I have a field named "Product_Group" and have ~ 10 Values in it.

For eg Product_Group : ABC, DEF, GHI, JKL, MNO, PQR, STU, VWX ,YZA and BCD.

I want to select ABC and want MNO to get slected automatically with this selection. This will be permanent and only when I select ABC.

On selection of others I dont want anything else to be selected.

Kindly let me know what should be the approch for it.

Thank you.

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Select 2 values in a Field using Macro/ Trigger

Try this:

=if(Product_Group='ABC','(ABC|MNO)', if(GetSelectedCount(Product_Group), '('& concat(Product_Group,'|') &')'))

It will prevent selecting all values in Product_Group when clearing all values.


talk is cheap, supply exceeds demand
3 Replies
MVP & Luminary
MVP & Luminary

Re: Select 2 values in a Field using Macro/ Trigger

Add a Select in Field action to the OnSelect trigger of your Product_Group field. The search string would be

=if(Product_Group='ABC','(ABC|MNO)', '('& concat(Product_Group,'|') &')')

See attached example


talk is cheap, supply exceeds demand
rathodniky
Contributor

Re: Select 2 values in a Field using Macro/ Trigger

Hi Gysbert,

I have just tried the OnSelect trigger

Field: Product_Group

Search String: =if(Product_Group='ABC','(ABC|MNO)', '('& concat(Product_Group,'|') &')')

This works But on Clear All.. There are some other values getting selected.. Cant figure why thats happening.

Thanks.

MVP & Luminary
MVP & Luminary

Re: Select 2 values in a Field using Macro/ Trigger

Try this:

=if(Product_Group='ABC','(ABC|MNO)', if(GetSelectedCount(Product_Group), '('& concat(Product_Group,'|') &')'))

It will prevent selecting all values in Product_Group when clearing all values.


talk is cheap, supply exceeds demand