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: 
YanivZi
Contributor III
Contributor III

Subfield Manipulation problem

Hi QlikSense community,

I'm currently facing an issue with the subfield function in QlikSense. I am using subfield to separate an array into fields, but it seems that QlikSense is automatically removing leading zeros during this process. Here's an example of the data I'm working with:

Original data:

01561300008000000;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
01561330008000002;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0


After using subfield, it becomes:

1561300008666542;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
1561330008666542;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0


As you can see, the leading zeros are removed from the first part of the field. I attempted to fill in the leading zeros using the NUM(MyField, '00000000000000000')[17 chars required] function, but the limitation in QlikSense of 14 characters makes this approach unsuccessful, resulting in null values when trying to manipulate it further with functions like LEFT, MID, etc.

The final result I'm aiming for is to transform MyField, which is subfield 1 (and similarly for the rest), into the format 015613-0008-666 (i.e., the first 6 characters, followed by a dash, then the next 4 characters, another dash,  the next 3 characters and finally remove the rest).

If anyone has encountered a similar situation or has ideas on how to overcome this limitation, your insights would be greatly appreciated! Thank you in advance for your help.

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

I'm not sure what exactly you're doing here - Subfield() doesn't impact the leading zero as far as I know.

Load Subfield((Field),';') as Field1
INLINE [
Field
01561300008000000;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
01561330008000002;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
];

Or_0-1690714967700.png

Note that you can use Text(SubField(Field)) to force the result to be rendered as text, rather than the dynamic result you'll get by just applying SubField().

View solution in original post

1 Reply
Or
MVP
MVP

I'm not sure what exactly you're doing here - Subfield() doesn't impact the leading zero as far as I know.

Load Subfield((Field),';') as Field1
INLINE [
Field
01561300008000000;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
01561330008000002;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0
];

Or_0-1690714967700.png

Note that you can use Text(SubField(Field)) to force the result to be rendered as text, rather than the dynamic result you'll get by just applying SubField().