Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create a dynamic fieldname in an expression

Hi all,

I want to use a dynamic fieldname in an expression, but I need some help.

In my project I have several fieldnames like:

Ind_AA_Time

Ind_BB_Time

Ind_CC_Time

Ind_DD_Time

The 'AA', 'BB', 'CC' en 'DD' are types of indicators and are stored in a table named 'Indication'.

I want to build the fieldnames dynamicly so I can use them in an expression in a pivot table. So the value of the fieldname is depending on the type of indicator. The indicator is a dimension of the pivot table.

My expression is now like this:

='Ind_'&Indication&'_Time'

It shows the correct fieldname into the column, but not the value of that field.

test.png

How can I build this expression, that it will return the value of the fieldname into the column? I'm sure it will be something silly, but I can't see a solution at this moment.

Thanks in advantage!

4 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

You need to use some dollar-sign expansion to evaluate your input.  Try:

=$(=('Ind_'&Indication&'_Time')) as the dimension (I may not have the syntax exactly right...)

Hope this helps,

Jason

Not applicable
Author

Not really, the Indication-part disappears in the string.

I tried everything with the $-sign, but nothing works properly.

To make it easier, I made a litte test-version and added it in my first post.

CELAMBARASAN
Partner - Champion
Partner - Champion

By linking incident name you can get the incident value

Indicator:

LOAD * INLINE [

Indication_name, Value_Ind

    Ind_AA_Time, 11

    Ind_BB_Time, 22

    Ind_CC_Time, 33

    Ind_DD_Time, 44

];

Directory;

LOAD Name,

     Indication,

     Value,

     'Ind_'&Indication&'_Time' AS Indication_name

FROM

test_dynamic_fieldname.qvw.xlsx

//[..\Desktop\Qlikview Project\test\test tussentotaal herbruiken.xlsx]

(ooxml, embedded labels, table is Blad1);

Check the attachment and let me know is this your requirement?

Not applicable
Author

Not exactly, I want to use this into a larger expression/formula. Something like this:

IF(Num#(Year)<varLY_BIO,1,(1+IF((varLY_BIO+IND_AA_TIME-Num#(Year))>0,(IND_AA_TIME/100/IND_AA_EXP)*(1+(Num#(Year)-varLY_BIO)),(IND_AA_EXP/100))));

But I didn't made a correct test-version. The version I uploaded now (test_dynamic_fieldname_2), is the correct version.

You will see 4 listboxes where the user can select a value and I want that value into an expression in the pivot table.

Let me know if you need more explanation!