Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
stevelord
Specialist
Specialist

Syntax for default state listbox to cause selections in alternate state listboxes?

Hi, I want to make my default state ClientName listbox trigger selection of that same ClientName in three alternate state listboxes. 

I imagine this would come in the form of an action in document properties/triggers - OnSelect in field $ClientName to make selections in field {[AlternateState1][AS2][AS3]}ClientName - just having difficulty locating the correct syntax to use for this.

I need the selections to happen in the [AlternateState]ClientName so they can constrain possible values in other listboxes of the alternate states.  I just want the user to only have to select the client in the default state vs selecting it in all of the alternate states I had to create.

(We're answering many FAQ about many activities in one round of selections so I had to use alternate states to get around some of the and-logic at the selection part and write it into expressions where desired at the answer part.)

Thanks in advance for any help!

1 Solution

Accepted Solutions
stevelord
Specialist
Specialist
Author

facepalm moment.  Search String: =ClientAccountName ='('&Concat(Distinct [ClientAccountName],'|')&')' -updated search string per a better solution I found for that piece from Gysbert W at https://qlikcommunity.qliktech.com/thread/63020

I was over thinking the tar out of it.  Sorry we couldn't tell which point I was going wrong at, but helpful points all around.   Thanks for your time!  Summary of complete solution:

1>FieldName: ClientAccountName

2> Alternate states setup: [AR HA] [AR Biometric] [AR Incentive]

3> Settings->Document Properties->Triggers->Field Event Triggers

4> I select ClientAccountName on the list then press OnSelect AddAction

5> In the new dialogue I press Add

6> ActionType: Selection then Action: Select In Field

Now the action is on my Actions  list

7> In the AlternateState drop-down below the Actions list I select the alternate state I want the trigger to affect

To the right there are two boxes for values/expressions: 'Field' and 'Search String'

Field: ClientAccountName

Search String: ='('&Concat(Distinct [ClientAccountName],'|')&')'

Search string I updated to that to allow multiple selections -Gysbert W provided this solution at

https://qlikcommunity.qliktech.com/thread/63020

(Figures I can't get through one complex issue without a Gysbert solution to ram it from 99 to 100% complete. )

Moreover, you will want an OnChange action, set it up the same way as above, except your Search String is like this:

=GetFieldSelections(ClientAccountName) -so when you clear or change the selection in the one box it clears in the others too.

I applied this trigger to the three alternate states, so a selection of client in either the default or alternate states will cause the client to be selected in all three alternate states with one click.

View solution in original post

10 Replies
swuehl
MVP
MVP

I think you need to select the alternate state from the drop down list located on the action dialog page.

Chanty4u
MVP
MVP

hi

you need to create 3 alternate states first

u can gve 3 list boxes with the diff alt states and in which the results u want that object u have to give the same altrnate state.

u can select alternate state in general tab where u can find in drop down list and u can select

default state in qlikview is inherited.

hope this helps

Thank you

Suresh

Not applicable

you can make a list box call ClientName 

go to properties and ensure that this is in the inherited stage

you can use the following syntax to refer this in all the alternate state

count( {[Group 1] <ClientName = $::ClientName> } Invoice)

ClientName = $::ClientName tell the set analysis to consider the values of ClientName from the inherited stage and [Group 1 ] indicates the stage it has to be referred

stevelord
Specialist
Specialist
Author

Thanks I feel like I'm chasing my tail a bit. Here are steps I am taking.  Steps I've taken are below.

Main question is: What do I enter in 'Field' and 'Search String' at the end of the add action process below?

1>FieldName: ClientAccountName

2> Alternate states setup: [AR HA] [AR Biometric] [AR Incentive]

3> Settings->Document Properties->Triggers->Field Event Triggers

4> I select ClientAccountName on the list then press OnSelect AddAction

5> In the new dialogue I press Add

6> ActionType: Selection then Action: Select In Field

Now the action is on my Actions  list

7> In the AlternateState drop-down below the Actions list I select AR HA (hoping this relates to the state I want the selection action to happen in, and not putting the action itself outside the default state)

To the right there are two boxes for values/expressions: 'Field' and 'Search String'

What should I type in:

Field:

Search String:

?

I've tried a variety of things that make sense, but when I select different clients on the client listbox in the default state, nothing happens in the client listboxes in the alternate state.  (Note my chart expressions all work fine referencing the alt. state listboxes, just trying to make a single listbox to operate some of the alt. state field selections and reduce the number of things end user has to make selections in.)

stevelord
Specialist
Specialist
Author

I just did an experiment with sheet properties to select a specific client in the alternate state client listboxes onopen of the document.

It looks like I just need to know what to type in the box called Search String: at the end of the add action process - to get it to synch with the field selection in the default state.

On my experiment I just typed the name of a specific client in Search String and now those boxes default to that client when I open the document.  Just need it to switch those boxes to the client selected in the default state listbox.

stevelord
Specialist
Specialist
Author

facepalm moment.  Search String: =ClientAccountName ='('&Concat(Distinct [ClientAccountName],'|')&')' -updated search string per a better solution I found for that piece from Gysbert W at https://qlikcommunity.qliktech.com/thread/63020

I was over thinking the tar out of it.  Sorry we couldn't tell which point I was going wrong at, but helpful points all around.   Thanks for your time!  Summary of complete solution:

1>FieldName: ClientAccountName

2> Alternate states setup: [AR HA] [AR Biometric] [AR Incentive]

3> Settings->Document Properties->Triggers->Field Event Triggers

4> I select ClientAccountName on the list then press OnSelect AddAction

5> In the new dialogue I press Add

6> ActionType: Selection then Action: Select In Field

Now the action is on my Actions  list

7> In the AlternateState drop-down below the Actions list I select the alternate state I want the trigger to affect

To the right there are two boxes for values/expressions: 'Field' and 'Search String'

Field: ClientAccountName

Search String: ='('&Concat(Distinct [ClientAccountName],'|')&')'

Search string I updated to that to allow multiple selections -Gysbert W provided this solution at

https://qlikcommunity.qliktech.com/thread/63020

(Figures I can't get through one complex issue without a Gysbert solution to ram it from 99 to 100% complete. )

Moreover, you will want an OnChange action, set it up the same way as above, except your Search String is like this:

=GetFieldSelections(ClientAccountName) -so when you clear or change the selection in the one box it clears in the others too.

I applied this trigger to the three alternate states, so a selection of client in either the default or alternate states will cause the client to be selected in all three alternate states with one click.

stevelord
Specialist
Specialist
Author

Both of my final Search String expressions came from that url to Gysbert's correct solution that augmented my 99% done solution.

harjedalskok
Creator
Creator

Hi Steve,

The solution works 100 % when the selection doesent have a blank in between.

So when i try to use it on salesmans for example " Andre Holmström" it doesent work.

Any idea what I should do to make it work?

thx in advance.

André

stevelord
Specialist
Specialist
Author

Gysbert Wasserstein provided syntax like this when I asked the same over in another thread he had replied to:

='('&Concat(Distinct chr(34) &  [Attribute Relation]  & chr(34),'|')&')'

In the search string box, put your fieldname in the middle of that other stuff to set a pipe delimiter between the values and handle the spaces.  (Attribute Relation is my field name in this case.)  Above is copied from one of my dashboards for expediency, but if you search around you might find the other threads asking about trigger search strings.

There will still be some playing around to do if you're dealing with alternate states but above gets you started on the trigger.  (Alternate states have the added complexity of needing it in the other states so they can effect each other wherever you click, and maybe something for toggle/onchange/clear in case someone uses that little eraser in a current selections box or simply deselects a value.)