Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Listbox Hack

What is the best possible way to create a listbox when data/cell can have multiple values?

Sample Data

AA

AA, BB

CC,DD,AA,BB

DD,BB

BB

EE

How to create a List Box with following selection for the user:

AA

BB

CC

DD

EE

So

if the user selects AA, then following items should be highligted from the table AA - AA, BB  - CC, DD, AA, BB

if the user selects BB, then following items should be highlighted from the table AA,BB - CC, DD, AA, BB, DD, BB

If the user selects AA and DD, then following items should be highlighted from the table AA -  AA,  BB  -  CC,  DD,  AA, BB, - DD,BB

Thanks!

1 Solution

Accepted Solutions
maxgro
MVP
MVP


maybe this?

1.png


SampleData:

load * inline [

field

AA

AA, BB

CC,DD,AA,BB

DD,BB

BB

EE

] (delimiter is ';') ;

Link:

load

  field,

  trim(subfield(field, ',')) as field2

Resident SampleData;

View solution in original post

5 Replies
maxgro
MVP
MVP


maybe this?

1.png


SampleData:

load * inline [

field

AA

AA, BB

CC,DD,AA,BB

DD,BB

BB

EE

] (delimiter is ';') ;

Link:

load

  field,

  trim(subfield(field, ',')) as field2

Resident SampleData;

Not applicable
Author

Perfect, thanks!

Not applicable
Author

Couple of Follow up....

1. How do you clean up list which is represented in following format?

11

22,   33, 4 4

33,22,    11

4 4,33

  22,11,4 4

55

66

/* how do we remove unwanted spaces. Also the Data has space '4 4 ' which is possible so REPLACE funtion won't be appropriate  */

2. We created two pie charts using 2 columns derived from subfield() but when we select data from one pie chart the other pie chart doesn't show accurate vaules.? Can you please invesitgate?

maxgro
MVP
MVP

1) to remove the space at the begin and at the end of every value you can trim the subfield (table Tmp) and then rebuild SampleData (concat with the id)

SampleData:

load rowno() as id, * inline [

field

11

22,   33, 4 4

33,22,    11

4 4,33

  22,11,4 4

55

66

] (delimiter is ';') ;

Tmp:

load id, trim(SubField(field, ',')) as field1, rowno() as id2    

Resident SampleData;

DROP Table SampleData;

SampleData:

load id, Concat(field1, ',', id2) as field

Resident Tmp

Group By id;

DROP Field id;

Link:

load

  field,

  trim(subfield(field, ',')) as field2

Resident SampleData;


1.png

2) I don't understand, better if you open a new discussion with an example (.qvw) of the problem



Not applicable
Author

Thanks Again!

Refer List, SubField and textCount