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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
stephenedberkg
Creator III
Creator III

Replace with null

if there no values in database i want to replace it by 0

Replace(ID,'','0') as ID

i am using this formula in script but i did't getting the answer.

10 Replies
sunny_talwar

Try this:

If(Len(Trim(ID)) = 0, 0, ID) as ID

Joaquin_Lazaro
Partner - Specialist II
Partner - Specialist II

Hi:


Try this Replace(ID,null(), 0) as ID


Joaquín

avinashelite

you can try like this too

If(ID = '' or ID=null() or isnull(ID), 0, ID) as ID

maxgro
MVP
MVP

it depends on the meaning of "no values"

alt(ID, 0) as ID

if(isnull(ID), 0, ID) as ID

len(trim(..........

as already suggested

stephenedberkg
Creator III
Creator III
Author

Dear sunindia

Tbl 1

ID   Sales

1      100

2       200

3       300

4       400

Tbl 2

ID            Lockperiod

1                   1

2                   2

3                   4

see ID 4 doesn't have lock period so in this case i want 0 as lock period for ID 4

sunny_talwar

Are you joining the two tables to add 0? How would table 2 know that there is a 4 that exists?

avinashelite

Try like this :

Tbl 1

ID   Sales

1      100

2       200

3       300

4       400

Tbl 2

ID            Lockperiod

1                   1

2                   2

3                   4

Temp:

LOAD ID as Key

resident

Tbl 2;

concatenate(Tbl 2)

LOAD ID ,

0 as Lockperiod,

resident

Tbl 1

where not exist(Key ,ID);

stephenedberkg
Creator III
Creator III
Author

If the ID is not matching with table 2 then for this ID i want to display lock period as 0