Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dgreenberg
Luminary Alumni
Luminary Alumni

Is it possible to reference the field name in the label?

Let's say I have a simple table with these fields

FirstName, LastName

I want to be able to use the field name in the label.  (hold on there is a method to my madness).

In and of itself that's completely unnecessary but what I want to ultimately get to is to be able to use a single expression for every single label that uses a variable to pull a friendly field name.

So for the firstName field lets say something like this (which definitely does not work)

LABEL:

='v' &$Field

where I am hoping to get this as the result

vFirstName

If they use that same expression

='v' &$Field


on the LastName field I want it to return vLastName.

I just don't think this is possible but I'll buy a pint for the first person to prove me wrong.

btw this has fooled me into thinking I was close when my expression returned a null it displayed the field name in the label but was actually using the default as if the label was not filled out.

15 Replies
dgreenberg
Luminary Alumni
Luminary Alumni
Author

We have over 500 fields in our data model and YES it's absolutely possible to do that manually but if a few hours can be done upfront to 1 cut down on manual work/manual errors and 2 make it far easier to maintain then it's well worth it.

dgreenberg
Luminary Alumni
Luminary Alumni
Author

Yup confirmation of what I said you can't do it. 

That's why I posted it to the forum to see if anyone had a thought just in case I was missing something.

Anil_Babu_Samineni

Are you doing whole fields with V extension in the script or Front end. Because, If you are doing Front end the only best option is manually rather some function (Even, Function also need to be done each dimension).

If it is script, I would ask you to provide little explanation more and please share sample where you are doing this

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

Closest thing I can see is

='v' & GetObjectField(0,'CH07')

Unfortunately that gives you more issues.

You have to know the object id you're in AND the order the dimensions are in.  (0 is the first dimension.)

If you figure something out please share it to help others.

Anonymous
Not applicable

As I was thinking about this....

The only other thing that occurred to me was to treat the different field names you want as though they were different languages.

But instead of language translations it would be more like division translations.

I would think the same theory would apply for your scenario.

Don't know if that's more or less work for you but it's an idea anyway that I thought I would mention.

See link.

How to Handle Multi-Language Translations in QlikView.zip

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

As you and Wallo have confirmed, I believe the answer is "No". I've never found a universal expression that would work for this requirement. The problem is that there is no "self" or "this" reference available.  Wouldn't it be great to have a function like:

ThisColumnProperty('Dimension.Name')

I can only wish.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com