Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Marius_
Contributor III
Contributor III

SQL database load results in a diffrent data outcome

Using a SQL Query on a SQL database returns the following data:

 

 

Marius__0-1713939123412.png

With the following result:

Marius__1-1713939168097.png

But executing the same SQL query into Qlikview returns the following:

Marius__2-1713939237984.png

toetsOnveranderd - Test with no change

toetsText - Using Text script formula to get text property

toetsJippo  - Self help method to force test property

With the following outcome in Qlikview:

Marius__3-1713939396974.png

It seems that the 'raw' data in the SQL database is 0965 (OneID,toetsOnveranderd)

But the SQL query in SQL returns (0965,965) (?)

And it seems that the script formula "Text" first identify the property is integer makes it a number and the concerts it to text 0965 -> 965 -> "965" 

[It must be noted that data input is from multiple sources into the SQL database].

This outcome of the usage of the the text formula vs 'raw' data causes a different result/outcome.

Any idea how to "fix" this?

 

 

 

 

 

Labels (1)
  • mysql

1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

By explicitly converting [OneID] to Text([OneID]), you can ensure that its length remains unchanged as in this specific case they represent two distinct values in the source table.

View solution in original post

3 Replies
BrunPierre
Partner - Master
Partner - Master

I think "OneID" is a varchar-type field, that's why "0992" and "992" would be treated as different values, because varchar fields are variable-length character strings, and they can store any combination of characters, including leading zeros.

Marius_
Contributor III
Contributor III
Author

Hi BrunPierre 

Thanks

I saw that on a SQL site where they described varchar, the use of the length of the field as descriptive purpose was used. 

My data is then:

Marius__0-1713959252400.png

With the outcome that, should any kind of formula (text OR len) be applied to the field, the length and thus the amount of characters will change!

Any idea how to fix/prevent this?

 

BrunPierre
Partner - Master
Partner - Master

By explicitly converting [OneID] to Text([OneID]), you can ensure that its length remains unchanged as in this specific case they represent two distinct values in the source table.