Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

"null" value to "1"

Hi all,

I have SQL table, how to set up , if the value is " null " written 1. Using my script i'm i get value "-"

/Sample/

[products]:

LOAD ID as [item.ID],

    Name as [pr.name],

    Code as [pr.code],

    TareWeight as [pr.twt],

    if ((TareWeight='Null') or (TareWeight=0),1,TareWeight) as [Weight]

    ;

SQL SELECT *

FROM postgres."public".erpoitm

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

try this:

[products]:

LOAD ID as [item.ID],

    Name as [pr.name],

    Code as [pr.code],

    TareWeight as [pr.twt],

    if(len(TareWeight)>0, TareWeight, 0) as [Weight]

    ;

SQL SELECT *

FROM postgres."public".erpoitm

Marc.

View solution in original post

6 Replies
Not applicable
Author

Hi,

you can write in SQL itself.

Select isnull(TareWeight,1) as TareWeight from postgres."public".erpoitm.

Not applicable
Author

Hi,

LOAD ID as [item.ID],

  Name as [pr.name],

    Code as [pr.code],

    TareWeight as [pr.twt],

alt(TareWeight,1) as [Weight],

if(isnull(TareWeight),1,TareWeight) as [Weight_NEW]

     ;

SQL SELECT *

FROM postgres."public".erpoitm

MarcoWedel

Alt(TareWeight,1) as [Weight]

Anonymous
Not applicable
Author

try this:

[products]:

LOAD ID as [item.ID],

    Name as [pr.name],

    Code as [pr.code],

    TareWeight as [pr.twt],

    if(len(TareWeight)>0, TareWeight, 0) as [Weight]

    ;

SQL SELECT *

FROM postgres."public".erpoitm

Marc.

Not applicable
Author

Thanks all for yours answers, resolved

markodonovan
Specialist
Specialist

Hi Aurimas,

You could also use the following

NullAsValue TareWeight;

SET NullValue = 1;

Thanks

Mark

https://www.techstuffy.com/course/practical-qlikview-qlikview-beginners/