Qlik Community
Collaborate with over 60,000 Qlik technologists and members around the world to get answers to your questions, and maximize success.
Join UsUpper function does not properly handle fields which contain numbers with leading zeros when used in a calculated dimension. It appears to converts text to number and does not return the expected value with leading zeros in a dimension expression.
Environment:
QlikView 12.20
QlikView 12.10
QlikView 11.20
Scenario: a data field loaded in script as TEXT using the Text() function.
LOAD
text(Text_Field) as Text_Field,
The field contains values that are: some numbers, some numbers with leading zeros, and some values with text. Example field values for 3 rows of data: 002006, 2006 and example as shown below. When the upper function is used in a chart on this dimension, the number value 2006 is returned for both rows 002006 and 2006. The expected result is that these will not be affected by use of the upper function, per help.qlik.com Upper script and chart function Nov 2018 documentation numbers should not be affected and should be ignored "Upper() converts all the characters in the input string to upper case for all text characters in the expression. Numbers and symbols are ignored."
It is expected that 00206 should return 002006 and 2006 should return 2006, when the Upper function is applied to these string/text values. It was found that Upper on the 002006 value returns 2006 and you can tell from the default presentation settings, the alignment of the data indicates that it is now a number (right aligned). So the Upper function returns what appears to be the incorrect value here and also makes the output a number when it should be text. Note this only happens when the expression is done on a dimension. The same expression in the sheet properties > Expressions tab works properly and returns the proper values however the alignment indicates it is number.. but the proper value is returned. Upper for 002006 returns 002006 and Upper of 2006 returns 2006 in an Expression from the expressions tab. It is expected that the Upper function should not change the data to number format and the end result should show as left aligned (text) and should return the correct value in both Dimension > Add Calculated Dimensions and also in the Expressions tab.
This is a representation of the final result in a chart > straight table for the Text_Field which was loaded in script as text
Text_Field |
Upper(Text_Field) |
Text(Upper(Text_Field)) as a calculated dimension | Upper(Text_Field) as an Expression in Expressions tab |
Text(Upper(Text_Field)) |
---|---|---|---|---|
002006 | 2006 | 002006 | 002006 | 002006 |
2006 | 2006 | 2006 | 2006 | 2006 |
Example | EXAMPLE | EXAMPLE | EXAMPLE | EXAMPLE |
The workaround/solution for this issue is to use the additional function in the to force the format of the result in the Calculated Dimension. In this example, an additional TEXT function is used to make sure the result is set to text format.
=text(upper(Text_Field))
This also shows the correct value for the 002006 row in the example above and the alignment visually indicates that it is in fact a text value.
The bug was closed as working as designed. A single Calculated Dimensions can include multiple references to multiple fields with different formats. As a result, an additional function will need to be used to force the desired format on the result.
Collaborate with over 60,000 Qlik technologists and members around the world to get answers to your questions, and maximize success.
Join UsSearch Qlik's Support Knowledge database or request assisted support for highly complex issues.
Submit a caseExperiencing a serious issue, please contact us by phone. For Data Integration related issues please refer to your onboarding documentation for current phone number.
Call Us