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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rudywelvaert
Creator
Creator

Using a string as a fieldname

Hi,

I would like to use a constructed string, for example:

'TID_MONTH_ABR_' & Num(Month(WORK_DATE), '00')

as a field name in a function, for example:

=Only(TID_MONTH_ABR_01)

=Only(TID_MONTH_ABR_02)

...

=Only(TID_MONTH_ABR_12)

Thus:

= Only('TID_MONTH_ABR_' & Num(Month(MONTHDATE), '00'))

I use these TID_ fields in a multilingual environment so the TID-field give me the correct translations in de selected language

So how can I use the string as a field name in a function. Do I put $() or {} or  ... around it?

R.W.

1 Solution

Accepted Solutions
sunny_talwar

May be with dollar sign expansion

=Only($(='TID_MONTH_ABR_' & Num(Month(MONTHDATE), '00')))

View solution in original post

2 Replies
sunny_talwar

May be with dollar sign expansion

=Only($(='TID_MONTH_ABR_' & Num(Month(MONTHDATE), '00')))

did
Employee
Employee

I'm wondering whether this approach can work for total <field>? 

It works fine: if within <> I write MyField , the formula then looks the following way:  sum(VALUE) / sum(total <MyField>  VALUE)

PROBLEM: MyField variates due to the drilling down, so that it can be MyField1,MyField2,MyField3...

It does not work: if within <> I write MyVariable containing the needed field, the formula then looks the following way:  sum(VALUE) / sum(total <vMyVariable> VALUE)

If vMyVariable returns me a string '' which should be interpreted as a field, then according to this post I need something like only($(=$(vMyVariable))) to put it within <> so that my formula looks like: sum(VALUE) / sum(total <only($(=$(vMyVariable))) > VALUE). Unfortunately this does not work for me.

Any ideas/suggestions are very much appreciated.