Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
BSCIknowlec
Contributor III
Contributor III

List Box auto selecting when one value is only shown

Hi Experts, hoping you can help me.

I'm looking to get one of my list boxes to automatically highlight its value when there is one value in it.

I.E - customer selects a different List box that shows them a Part number. they select a part number and another list box, that contains batch numbers associated with that selected part shows. when the return from the batch number list box is  = 1, the list box should automatically select it so that the associated graph update as well.

any ideas?

 

thank you,

Ciaran

Labels (3)
1 Solution

Accepted Solutions
edwin
Master II
Master II

Selection of a field value is an ACTION.  actions can be done 2 ways: 1st by a user actually clicking, and 2nd by Triggers.
i would generally shy from using triggers because it can get cleared when there is no data for the field that triggers the action.  but to answer your question directly and as a learning exercise,

set a trigger for the PART.  when the PART is selected or changed,  set the action to SELECT FIELD BATCH to ONLY(BATCH)  

when a single value of PART is selected, the BATCH associated with that will automatically be selected.  of course you need to expand on that.  you have to account for what if multiple values are selected what possible user experience you want to program for - what is expected, and all that fun stuff

HAVING SAID THAT...  i suggest do it a different way instead (and this im saying without knowing what other business rules/requirements you have).  if what you want for example is to enable a chart that is dependent on a BATCH being selected, change the logic a little and set it SAY, conditional to count(distinct BATCH) = 1, or getpossiblecount(BATCH)=1

hope that helps

View solution in original post

2 Replies
edwin
Master II
Master II

Selection of a field value is an ACTION.  actions can be done 2 ways: 1st by a user actually clicking, and 2nd by Triggers.
i would generally shy from using triggers because it can get cleared when there is no data for the field that triggers the action.  but to answer your question directly and as a learning exercise,

set a trigger for the PART.  when the PART is selected or changed,  set the action to SELECT FIELD BATCH to ONLY(BATCH)  

when a single value of PART is selected, the BATCH associated with that will automatically be selected.  of course you need to expand on that.  you have to account for what if multiple values are selected what possible user experience you want to program for - what is expected, and all that fun stuff

HAVING SAID THAT...  i suggest do it a different way instead (and this im saying without knowing what other business rules/requirements you have).  if what you want for example is to enable a chart that is dependent on a BATCH being selected, change the logic a little and set it SAY, conditional to count(distinct BATCH) = 1, or getpossiblecount(BATCH)=1

hope that helps

BSCIknowlec
Contributor III
Contributor III
Author

Hi Edwin,

yes you are absolutely right with your comment. i think the best way would be to change the conditional on my graphs. i had it set to getSelectedCount but your other advice for distinct works better.

thanks you!