Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mohan2391
Creator III
Creator III

Add values in a listbox

Hi,

Is it possible to add a few new values in an existed field(ListBox) based on a condition that if 1 of them get selected it should select a set of existed field values ?

Ex: 1. I have a field called NAME with values A,B,C,D,E,F (Default values from Database)

      2. I wanted to have 2 more values in that field X,Y (Need to include manually) (Finally NAME field with values A,B,C,D,E,F,X,Y)

      3. When I select X from this listbox, it should select A,B,C and when i select Y it should select D,E,F

So is it possible to achieve ?

Thanks

2 Replies
Digvijay_Singh

I dont think it is possible, instead you may think of having one more field with the value X and Y and can link to specific combination of values of NAME in the script by joining them.

Using inputfield you may change values manually in UI but you would need to add placeholders manually in script -

FromDatabase:

INPUTFIELD Name;

Load RecNo() as Key,Name;

Load * inline [

Name

A

B

C

D

E

F ];

Concatenate

Load RowNo() as Key,* inline [

Name

X

Y ];

Regards,

eespiritu
Creator
Creator

Hi Mohan, try to use this:

//Load from the source, using load inline as sample

Table:

LOAD * INLINE [

    NAME

    A

    B

    C

    D

    E

    F

];

//Loading new values

LOAD * INLINE [

    NAME

    X

    Y

];

Now, in the front end, you need create a variable, I created vSelected.

Go to Settings - Document Properties - Triggers tab, on Field Event Triggers section, select NAME field and then click on Add Action(s) button on 'OnSelect' type.

Add a new external action, Set Variable, and put the next:

Variable box: vSelected

Value box: =GetFieldSelections(NAME,',')

For this specific feature that you need, you must apply actions, so, create a new button object and add the next action:

Select in Field action on Action Type: Selection. Put the next:

Field box: NAME

Searching String: =if('$(vSelected)' = 'X','('&Replace('A,B,C',',','*|*')&')', if('$(vSelected)' = 'Y','('&Replace('D,E,F',',','*|*')&')',vSelected))

Now, create a listbox object, using the NAME field and select X or Y value, then click on your new button and see the result.

Regards,

Enrique.