Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
bluecarbon
Partner - Creator
Partner - Creator

FirstSortedValue along with Trigger not working.

Hi,

I have a sample application with below set of value.

    Country, Product, Rank

    Country1, Product1, 1

    Country1, Product2, 2

    Country2, Product2, 1

In above example, FirstSortedValue of Country1 is Product1 and for Country2 is Product2 by using the expression =FirstSortedValue(Product,Rank).

But when I have two list boxes one for Country and another one for Product and when I try to add trigger to field level to Country field to select FirstSortedValue in Product list whenever a Country is selected.

When I select Country1 Product1 is selected and when i select Country2 Product2 is selected.

The issue is when I select Country1 again Product2 is selected or it is not selecting Product1. Tried adding Clear Field event too but nothing helps me.

Thanks,

Rakul.

1 Solution

Accepted Solutions
sunny_talwar

Try to use this as your search string

=FirstSortedValue({<Product>}Product,Rank)

View solution in original post

6 Replies
sunny_talwar

Try to use this as your search string

=FirstSortedValue({<Product>}Product,Rank)

pokassov
Specialist
Specialist

Hello!

change trigger like that:

=FirstSortedValue({$<Product=>}Product,Rank)

Best wishes, Sergey

bluecarbon
Partner - Creator
Partner - Creator
Author

Hi Thanks,

Can you explain me what is the set expression doing here.

Thanks,

Rakul

sunny_talwar

The issue was that once a single product was selected, the firstsortedvalue was not able to look for anything outside of that selection. So even when Country1 was selected back, the only possible value was Product2. Once we ignored selection in Product field, we got what we wanted.

HTH

Best,

Sunny

bluecarbon
Partner - Creator
Partner - Creator
Author

Hi Sunny,

If I m using an expression for displaying the products belonging to country then I m not able to make any further selections to Product List box.

Product List box as expression   =If(Country=GetFieldSelections(Country),Product)

sunny_talwar

Not sure what you are trying to do, but try this to see if this is what you were looking for (New Product list box in the attached application)

=Aggr(Only({<Product>}Product), Product)