Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load field with inizial space

Good Morning,

i have a database SQL with a table with two fields (Code - char 20 / Description - char 40). Sometimes the Code field is populated not from column 1 (see examples) and when i LOAD the Code field in Qlikview the initial spaces are left out.

Example column CODE Load in Qlikview

001 002 01 001 002 01

001 02004 001 02004

002 01 002 01

I would like the LOAD command to respect the data of the database:

Load in Qlikview

001 002 01

001 02004

002 01

How can i do it ?

Thank You

Paolo

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Paolo,
The first thing to try is to use text() function:
text(CODE) as CODE.

(On the other hand - why do you want this? Maybe you're trying to fix the wrong problem...)

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Paolo,
The first thing to try is to use text() function:
text(CODE) as CODE.

(On the other hand - why do you want this? Maybe you're trying to fix the wrong problem...)

Not applicable
Author

I try but the problem is not solve.

I want this because the first 3 characters are the sizes of the Article, the next 1 is the model, the next 3 are the colours ecc...

When i want to analize the sizei must have the exact code ("001"," 00", " ") to retrieve the description of the code (i could have article without size).

Why Qlikview LOAD in this way ?

Thank You

Paolo

Anonymous
Not applicable
Author

So, are these columns (Article, model, etc.) are all concatenated in one field in the database?
Looks really strange, but still shouldn't be a big deal, if you know exactly the order and length of the parts. You can use len() and mid() functions in this case to cut it in the correct pieces.

Not applicable
Author

The "Article" value is in another field.

I resolve the problem with the command replace to substitute " " with "_".

But i don't understand because Qlikview cut off the space:it does not an error ?

Thank You

P.S.

I have the same case if i fill an Excel fle in the same way.

Anonymous
Not applicable
Author

the questions "why" don't have technical answers... Tongue Tied
Qlikview, like Excel, "assumes" that if all characters are numbers, the whole data piece is numeric. Both cut off the lesding spaces and 0's. So, we have to use some additional measures if it it's not a number...

Not applicable
Author

I try to input in fileld Code only character (replace the number) with initial spaces but the result is the same: Qlikview cut off the initial spaces.

The same test in Excel: i input " A" (three initial spaces) in column A and when i load in QLIKVIEW the value was "A" without the initial spaces.

Why ?

Thank You

Paolo

Anonymous
Not applicable
Author

That's a good question for QlikTech. There is function trim() that eliminates leading and trailng spaces - that implies that they should not be eliminated by default...

Not applicable
Author

I found the variable "Verbatim" in the manual.

At the start of the script i must write "Set Verbatim = 1" and Qlikview don't cut off the initial spaces.

Thank You

Paolo

Anonymous
Not applicable
Author

Good to know. Smile
Thanks Paolo