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: 
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
sunny_talwar

Not entirely sure what you are after... do you have a sample where you can show what you looking to do?

Anonymous
Not applicable

Not sure what you're after either.  If you want friendly field names you should rename them in the script to those friendly names.

dgreenberg
Luminary Alumni
Luminary Alumni
Author

I want to be able to set the label for any field to literally = v plus the field name

so if I add a dimension fName to a chart using the same expression the label should return a result of vFname and that very same expression used on a different field lName would return a result of vLname.

The end game is to use a single expression in every fields label to pull the friendly name as the label.

Since it doesn't work and doesn't seem possible there is nothing for me to attach.

Use any data the request is the same the label should take the field name and preface it with the letter v so a field called city returns a label of vCity.

vishsaggi
Champion III
Champion III

I am not entirely sure what exactly is your output but try these?

label 1 FirstName

= 'v' & Subfield(Concat($Field, '|'), '|', 1)

label 2 LastName

= 'v' & Subfield(Concat($Field, '|'), '|', 2)

Capture.PNG

dgreenberg
Luminary Alumni
Luminary Alumni
Author

Ah but we can't do that for so many reasons.

We have a common data model but each individual dashboard for different divisions may want the field display name to be something else.  Partner for example may have a label of Eng Leader for one division and that very same field would have a label of Engagement Partner for another.

We have a good solution in place when we put a report builder where they can pick their fields but not if you are building a static chart.

I am currently spending a few hours a week on constant influx of label changes that differ on the very same field for different divisions.  I feel essentially this is a bad bad approach and we should not make so many changes and have them different for different dashboards but we have to please the end user.

Given that I thought wouldn't it be nice if ='v'&$($Field) returned vCity for City and vState for State so I could use the very same expression ='v'&$($Field) as the label for every single field.

sunny_talwar

Not 100% sure, but have you tried dollar sign expansion?

[$(='v' &$Field)]

dgreenberg
Luminary Alumni
Luminary Alumni
Author

Appreciate the effort but we are not on the same page

qv.png

In that straight table chart above I want the properties for the label to be like this

qv2.png

Anil_Babu_Samineni

Even, You are doing manually Why can't simply Label as you required

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anonymous
Not applicable

I see.  You intend to have a variable for every field label that will cause it to show the name users want.

I think you're going to have to just type in the variable for each.

something like

=(vCEACPartner)

and

=(vPartnerName)

I'm assuming you're loading all the variables from a spreadsheet or something like that.

That said, even though you don't like it, the better user experience will still be to rename your fields in your script usling something like this:

How to Rename Fields using Mapping Table

Otherwise, when users make selections, the current selections box shows the real name not the label name.