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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Wrong data displayed in QlikView when loading from database

Hi Folks,

We're facing a strange error while reading the data from databse.

We're trying to load the following fields is_current,is_original flags which are of bit data type(in database) to Qlikview. In Database the flags are either 0 or 1.

But when I load these values in to QlikView, 1 appears to be -1. Indeed very strange.

Can any one has experienced this kind of error. I'm about worried that my client will lose interest on QlikView if I notify him about this error.

Kindly advise me.

Thanks,

Surendra

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

The 1 value in your database means True and 0 means False. In Qlikview True is shown as value -1 and False as 0. It's really as simple as that. If you don't like it that way you could simply multiply the values with -1 when loading so every -1 becomes 1.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Probably the database driver delivers your flag data as BYTE with all bits set to 1, which will be read as -1 by QV.

If you want a 1 instead of -1, just multiply by -1 when reading in

LOAD

     -1 * is_current            AS      is_current,

...;

SELECT ... FROM ...;

If you want to use the flag as boolean,  -1 is interpreted as TRUE, so there is nothing to do.

Not applicable
Author

If I want to get the desired value I can fabs function instead. But my question is why QlikView is showing 1 as -1.

I've changed the data type of corresponding field in database to int.

Yet I'm getting the same output.

gaurav2017
Creator II
Creator II

Hi,

Please ask to QlikTech.

Regards,

Not applicable
Author

it is due to differences in the way the boolean type is handled by ODBC and OLEDB driver.

ODBC treats the boolean as a bit type, which has possible values of 0 and 1 where OLEDB treat as different .

but it doesn't matter  since -1 treated as true...

or els you can Fabs