Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

Making a field unique in its characters

HI,

Please note that if  a particular field loaded in to a pivot table carries no unique characters how it will be corrected.See some sample data.

ME_CODE          CLASS_CODE          PREMIUM

0783                    MC                              500.00

00783                  MC                              1500.00

1615                    M4                               1000.00

21115                   M3                               1500.00

7125                    M4                               10000.00

As per above data, ME_CODE varies. But the unique number of characters to be five like (00783, 21115). Other numbers to be added  a zero in front of them. Please let me know whether can it be done in the script or through an expression if so how?

Thanks

Neville

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Kind of strange that you see both 0783 and 00783. As you probably know, Qlik will store values as dual values, i.e. using a numeric and textual representation, but there will be only one textual representation per underlying number.

So 783 should be represented either by 0783 or 00783 (in your sample), but not showing both.

Have you maybe loaded ME_CODE as pure text values using Text() function?

Besides this, you can get a consistent format using 5 digits using the formatting function Num() and a format code:

LOAD

     Num(ME_CODE,'00000') as ME_CODE,

     ...

View solution in original post

1 Reply
swuehl
MVP
MVP

Kind of strange that you see both 0783 and 00783. As you probably know, Qlik will store values as dual values, i.e. using a numeric and textual representation, but there will be only one textual representation per underlying number.

So 783 should be represented either by 0783 or 00783 (in your sample), but not showing both.

Have you maybe loaded ME_CODE as pure text values using Text() function?

Besides this, you can get a consistent format using 5 digits using the formatting function Num() and a format code:

LOAD

     Num(ME_CODE,'00000') as ME_CODE,

     ...