Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

possible to have field names in a list box?

hi guys,

1) is it possible to have field names of a table in a list box?

table1 has fieldA, fieldB and fieldC...

a list box will have fieldA, fieldB and fieldC as its options...

2) if part 1 can be done, can i adjust the chart based on the option selected in the list box?

whenever i choose fieldA, a calculation based on fieldA will appear on the chart and whenever i choose fieldB, a calculation based on fieldB will appear on the same chart...

2) or can i hide charts based on selections?

when i select fieldA, the chart based on fieldA will appear and the charts for fieldB and fieldC will be hidden from me and when select fieldB, the chart based on fieldB will appear and the charts for fieldA and fieldC will be hidden from me...

thanks in advance

1 Solution

Accepted Solutions
MVP
MVP

Re: possible to have field names in a list box?

Hello,

Yes, it's possible. You can create a new listbox and set an expression with

=$Field

To get all the fields you have loaded in your model.

And you can use

=GetFieldSelections($Field)

To get the name of the field selected, and use it later as part of an expression.

Anyway, I'd create variables in the script with the fields or formulas you want to use and let the user select among this variables.

To show conditionally a chart, go to the chart properties, Layout tab, and set there the conditional, something like

GetFieldSelections($Field) = 'Field1'

So the chart will be displayed only if Field1 is selected. Any valid expression in QlikView can be used in this conditional.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

8 Replies
MVP
MVP

Re: possible to have field names in a list box?

Hello,

Yes, it's possible. You can create a new listbox and set an expression with

=$Field

To get all the fields you have loaded in your model.

And you can use

=GetFieldSelections($Field)

To get the name of the field selected, and use it later as part of an expression.

Anyway, I'd create variables in the script with the fields or formulas you want to use and let the user select among this variables.

To show conditionally a chart, go to the chart properties, Layout tab, and set there the conditional, something like

GetFieldSelections($Field) = 'Field1'

So the chart will be displayed only if Field1 is selected. Any valid expression in QlikView can be used in this conditional.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable

possible to have field names in a list box?

hi miguel thanks for your reply,

i do not want all fields to be loaded in that multi box, only a selected few...

and how exactly do you use =GetFieldSelections($Field)? i tried it in a text option and it didnt shown anything based on my multi box's selection...

MVP
MVP

possible to have field names in a list box?

Hi,

If you don't want all fields to be loaded, then use any kind of conditional to get only the field names you expect. Performance may be affected and it would be better to create new fields or variables in the script time to use them in expressions.

The text object with GetFieldSelections() will only show when some selection is done (one or more values).

Not knowing better what exactly are you using those functions, I can only say that it's working as expected in version 10 SR2 build 8935.7 using $Field in both listbox and multibox and a text object having only the function as above.

Regards.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

apprentice
New Contributor III

Re: possible to have field names in a list box?

Dear Axon SG,

I do not know if the attached can help.

Best regards

Antonio

Not applicable

Re: possible to have field names in a list box?

hi miguel,

yea conditions seem to be inefficient, especially if you have a table with many fields...

i also found out searching through the community that i could hide/unhide objects too so i went to create an excel file with just one column and the fields i want from table1 as values under that column... then i went to load it and create a multibox to get the function of a dropdownlist... however, how do i get the value of the selected option?

Not applicable

Re: possible to have field names in a list box?

hi apprentice thanks for your reply,

i'm using the free personal edition so i will be unable to open ur file, could you paste the codes here?

apprentice
New Contributor III

Re: possible to have field names in a list box?

Dear Axon SG,

code is:

LOAD *Inline [

field1, field2, field3

123,abc,!"£

456,def,$%&

];

and here are two pictures showing what is in the file (see also attached):

1.jpg

2.jpg

Hope it helps

Antonio

Not applicable

Re: possible to have field names in a list box?

hi apprentice,

your example seems similar to what i have attempted, which is to create an excel file with the fields of the table as the values

for e.g.,

NewExcelColumn

field1OfTable1

field2OfTable1

field3OfTable1

then i loaded that new excel file and used the NewExcelColumn as a dropdownlist in a multibox...

i had to use a dropdownlist since i only want one selection to happen at 1 time since i only want 1 chart to appear at the same spot at 1 time...

when field1OfTable1 is selected, the chart related to field1OfTable1 will appear while the rest will be hidden and the same happens to the rest of the selections...

however, i have not tried using GetFieldSelections on the dropdownlist... am i supposed to do this, =GetFieldSelections(NewExcelColumn) = 'field1OfTable1'

unable to try it at the time of posting because i'm not at the workstation now...