Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Straight table: Label as a function of the field name; or, Get relative column position in a straight table.

I would like to create a label for each column in a straight table that is a function of the fieldname in that column.

For example: The straight table object name is CH01. The field in the first column (0) is Orders.Customer_Name.

I would like to create a function for the Label that trims the Orders. part from the field name and replaces the underscore with a space. I am able to use the replace or the textbetween functions in conjunction with the GetObjectField function if I explicitly pass the column number. In this case, column 0:  =Replace(Replace(GetObjectField(0,'CH01'),'_',' '),'Orders.','')

Unfortunately, using the GetObjectField function, I have to explicitly pass the column number. If the columns get rearranged, the labels no longer reflect the current column.

  1. Is there a way to better retrieve the field name in the function in my label without using the GetObjectField function?
  2. Or, is there a way to identify/pass the relative column position into the function that I have created?

An example application is attached.

Any suggestions would be greatly appreciated.

5 Replies
Not applicable
Author

Hi melisa,

Please check the below screen shot it may help you to change your column name.

Column name.png

xx.png

Thanks.

Not applicable
Author

This does not help me. All you have done is show me how to manually label a field

Not applicable
Author

Hi melisa,

what you did is correct please check the below screenshot. but bit confused why you are getting the same column name .

Test.png

Not applicable
Author

I want to create a function that will translate the qualified fieldname into short friendly label without underscores that will wrap neatly.

The function I have written does this, but this function requires that I explicitly declare the relative location of the column.

It is not dynamic based on the column order, so if I drag the column left or right from its original explicitly-declared position, the relative position no longer matches the explicitly declared position.

My question remains:

  1. Is there a way to better retrieve the field name in the function in my label without using the GetObjectField function which requires me to explicitly declare the position?
  2. Or, is there a way to identify/pass the relative column position into the function that I have created?
Not applicable
Author

I want to create a function that will translate the qualified fieldname into short friendly label without underscores that will wrap neatly.

The function I have written does this, but this function requires that I explicitly declare the relative location of the column.

It is not dynamic based on the column order, so if I drag the column left or right from its original explicitly-declared position, the relative position no longer matches the explicitly declared position.