Let's say I have a simple table with these fields
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)
where I am hoping to get this as the result
If they use that same expression
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.
Not sure what you're after either. If you want friendly field names you should rename them in the script to those friendly names.
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.
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)
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.
Appreciate the effort but we are not on the same page
In that straight table chart above I want the properties for the label to be like this
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.
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:
Otherwise, when users make selections, the current selections box shows the real name not the label name.