Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create Variables from Fields in Load Script

Hi All,

I have a template I am creating in Qlikview. One tab will be called "filters" and I want to list out all possible fields in listboxes. (normally, I would right click select fields, highlight all and add them to the dashboard)

Since this will be a template, I would like to create listboxes under variable names and set those variables to fields in the edit script, so that once those variables are defined, the listboxes will show those field names and the data to select from.

Currently I have this script which I used from another post. However, in my listbox, I just see one paid amount (I know there are at least 800 different amounts) and the title of my listbox is one amount as well.

Data:

SQL Select top 1000 *

FROM "databasename".dbo.tablename;

temp:

Load DISTINCT( paid_amount) as FieldA

Resident Data;

Let Variable1=Peek('FieldA',0,'tmp');

I would like the edit script to have my loaded table and then another load that renames all of the fields- for example

Data:

SQL Load

Name

Address

paid_amount

from xx.xxx

Filters:

name as variable1

address as variable2

paid_amount as variable3

resident data

Can someone please help?!

Thanks!!

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I suspect your problem is in your listbox expression.

You can load the fieldnames of interest into a single field like this:

Filters:

LOAD * INLINE [

Filter

Dim1

Dim2

Dim3

];

In your listbox, use <Expression> and define the expression as:

=$(='[' & FieldValue('Filter',1) & ']')

That would be for the first Filter, substitute "2" for "1" and so on.

If you want all fields in the application, you don't need to create a Filter field, Instead you can use the system field $Field.

=$(='[' & FieldValue('$Field',1) & ']')

Example attached.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I suspect your problem is in your listbox expression.

You can load the fieldnames of interest into a single field like this:

Filters:

LOAD * INLINE [

Filter

Dim1

Dim2

Dim3

];

In your listbox, use <Expression> and define the expression as:

=$(='[' & FieldValue('Filter',1) & ']')

That would be for the first Filter, substitute "2" for "1" and so on.

If you want all fields in the application, you don't need to create a Filter field, Instead you can use the system field $Field.

=$(='[' & FieldValue('$Field',1) & ']')

Example attached.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com