Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Is it possible to use a variable as a part of a field name

Hi. I´m trying to change the name of a field which is in to an expression using a variable as a part of the field name.

For example something like this:

    Having 2 measures:   Quantity, and Sales

     And a group of fields that contains the measure in the field name: Qty_month , S_month

Is possible to do something like this:

    Create a variable:  V_measure which will have 2 possible values 'Qty' or 'S' an use it in a expression as follows:

                                                               SUM(V_measure&'_month')  

Thank you

1 Solution

Accepted Solutions

Re: Is it possible to use a variable as a part of a field name

Hi,

Yes, that's indeed possible and quite useful in cases like yours, or multilanguage scenarios. This will work in a multibox, and will work as well in any expression:

="$(='Year ' & vTypeOfDate)"

Where Year is the fixed part and vTypeOfDate a variable with some fixed values the user can select. Depending on that selection, the field and values shown will differ according to the complete result of that expression.

Hope that helps.

Miguel

4 Replies
jjfabian
Contributor III

Re: Is it possible to use a variable as a part of a field name

Hi there,

I don't know about your specific problem, but I would build 2 expressions and enable them conditionally instead. That should work for sure.

Not applicable

Re: Is it possible to use a variable as a part of a field name

Hi Jakob.

Now I´ve a huge expression with nested IF, and I´m trying to simplify the expression.

I´m asking because I´ve more than 2 measures, that was only an example.

Thanks for answering

Re: Is it possible to use a variable as a part of a field name

Hi,

Yes, that's indeed possible and quite useful in cases like yours, or multilanguage scenarios. This will work in a multibox, and will work as well in any expression:

="$(='Year ' & vTypeOfDate)"

Where Year is the fixed part and vTypeOfDate a variable with some fixed values the user can select. Depending on that selection, the field and values shown will differ according to the complete result of that expression.

Hope that helps.

Miguel

Not applicable

Re: Is it possible to use a variable as a part of a field name

Hi Miguel

Your answer have put me in the way. With your help this is the expression i've built:

=sum($(=V_measure&'_Month'))   And it Works !!!!   

Thank you !!!

Community Browser