Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Peyman
Contributor
Contributor

How can i prevent Qlik Sense from automaticly renaming the field names in expresions?

Hi everybody,

is there any way, to deactivate the automaticly renaming of fields in a sense app, after changing them in script?

Best regards

Pey

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm curious as to why you would not want the rename to happen, but I'll also address your question.

You cannot disable the feature, but you can "break" the auto-renaming by understanding how Qlik does the auto renaming. For the auto rename to work, the field must have the same ordinal position in the table.  Given these two examples of updating and reloading a Load statement.

This will rename in expressions:
LOAD
  Name,
  Address as "Customer Address",  // will be auto changed in expressions. 
  City
from...

This will not rename in expressions. 
LOAD
  1 as dummyField,
  Name,
  Address as "Customer Address",  // will not rename, position has changed. 
  City
from...

So you can break the auto rename by adding a new field at the top of the Load statement at the same time you are changing other field names.  After one reload, you can remove the dummy field and reload again. 

Now tell me why you want to do this 🙂 I'm always teaching people how to make it work.

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

 

View solution in original post

8 Replies
Kiruthiga
Contributor
Contributor

You can try loading it with a variable in the script and assigning it to a new variable in the template expression with the desired field name 

Peyman
Contributor
Contributor
Author

Thank you for your answer! But can you please answer the quesion if you can?
I think i have expressed it clearly!

Regards
Pey

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm curious as to why you would not want the rename to happen, but I'll also address your question.

You cannot disable the feature, but you can "break" the auto-renaming by understanding how Qlik does the auto renaming. For the auto rename to work, the field must have the same ordinal position in the table.  Given these two examples of updating and reloading a Load statement.

This will rename in expressions:
LOAD
  Name,
  Address as "Customer Address",  // will be auto changed in expressions. 
  City
from...

This will not rename in expressions. 
LOAD
  1 as dummyField,
  Name,
  Address as "Customer Address",  // will not rename, position has changed. 
  City
from...

So you can break the auto rename by adding a new field at the top of the Load statement at the same time you are changing other field names.  After one reload, you can remove the dummy field and reload again. 

Now tell me why you want to do this 🙂 I'm always teaching people how to make it work.

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

 

Peyman
Contributor
Contributor
Author

I wounder, who has marked rob's answer as a solution! If it's my question, if it's my problem, this is not the solution, only a work around and it dosn't solve my problem!!!!!!!

Regards!
Pey

Peyman
Contributor
Contributor
Author

Dear Rob,

it is nice to read from you! 🙂

And to your question, why i wouldnt want the rename to happen:

We have a product that has a multilingual data-model.
Because in sense you see the field name at the selection pan, its very important for us, that the end users see a meaningful field name. If your german is not that good, "Sachbearbeiter" as selected field name, wouldnt help you to understand what is selected.

In our product it's possible to choose the data-model language in script. The base tables(QVDs) are all in English and based on a variable, you can choose that language of data-model in script.

That means every master elemnt, dimenstion and measures works ALREADY with variables.

The problem is, that a measure has the same name as a field and this measure is used in other measures as well. The renaming only changes the name of this measure in other measures (the master elemnt's name but wouldn't change) and this is the problem.

The ordinal position is new to me, thank you for this valuable information!
But it wouldn't solve my problem, because the load statement is generated automaticly in script and i cant manually add a dummy field or drop it.

As i said, i need a way to deactivate this feature.

 

Best regards
Pey

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Thanks for explaining your use case. I understand.  A couple of comments. 

"The problem is, that a measure has the same name as a field and this measure is used in other measures as well. The renaming only changes the name of this measure in other measures (the master element's name but wouldn't change) and this is the problem."

I believe this in unintentional and a reportable bug.  Master Measure references in an expression should not be renamed when a field is renamed. 

"a measure has the same name as a field"

I  recommend to not use the same name for a Field, Measure or Variable. The aforementioned bug aside, there are too many possibilities for ambiguity. This is the recommendation I make in QSDA Pro and it is also recommended in the Qlik doc: "You should not use the same name for a field and a variable (or a measure)"  https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Expressions/references-f...

-Rob

Peyman
Contributor
Contributor
Author

Thank you for your comments, Rob!


I do agree that this is a bug. Because by calculation, Sense considers the master measure and not the field, if they have the same names. Same logic must be considered, when renaming.


I try to avoid using the same name for my measures and fields and ... As a software developer with more than 40 years of experience (started with GW-Basic on a commodore 64) i know better than anybody else, how important explicitly is.


But there are many use cases, you cannot avoid this. If human language by designing the software (data-model, table names, fields ...) is a main point, such cases are not avoidable always.


I'm not going to change the names. Quantity is for me and end users of my "Self Service BI" Quantity.
But based on your point about ordinality, i changed the function who generates the load statement based on the translated field names. Now every field has a random number and concatenate uses this number as sort order. Each new load would give a different load statement with the same content. It works.


P.S. Do you know who has marked this post as solved? The right answer is "There is no way to prevent Sense from automatically renaming the field names in app". This must be marked as the right answer. Or somebody can say me, how can i disable this feature. I think keeping this community reliable and honest is very important.


Best Regards
Pey

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"P.S. Do you know who has marked this post as solved?"

I do not. If it was not you then I assume it was someone with moderator privileges. 

BTW, I would mark my answer as solution if this was my question.  I've added the explicit statement that "you cannot disable this feature" (to my knowledge).

-Rob