Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
vignesh_s
Creator
Creator

Script to Obtain Previous Value for Null Value

hi everyone, i tried to obtain previous value for null values and wrote the script as shown in screenshot, but the result i got was not correct, can any please give the solution for this

2.png,Untitled.png

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Try to replace

Pick(Value1) with Pick(Value)

View solution in original post

10 Replies
antoniotiman
Master III
Master III

Try to replace

Pick(Value1) with Pick(Value)

View solution in original post

trdandamudi
Master II
Master II

May be as below:

Load Date1,
Properties1,
If (Len(Trim(Value1))=0, Peek('Value'),Value1) as Value
Resident temp1;

drop table temp1;

vignesh_s
Creator
Creator

thanks for rply @Thirumala

i tried ur script but the result is wrng

3.png4.png

PrashantSangle

Hi,

Logic suggested by trdandamudi‌ must work.

Data:

LOAD * INLINE [

    Date1, Properties, Value1

    11/12/12, A/c, 40

    12/12/12, A/c,

    13/12/12, A/c, 50

    14/12/12, Fridge, 100

    15/12/12, Fridge,

    16/12/12, Fridge,

    17/12/12, Fridge, 250

    15/12/12, TV, 350

    16/12/12, TV,

    27/12/12, TV,

];

NoConcatenate

final_Data:

Load Date1 as Date,

Properties as Property,

if(len(trim(Value1))=0,Peek('Value'),Value1) as Value

Resident Data;

DROP Table Data;

EXIT SCRIPT;

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
tresesco
MVP
MVP

In the screen shot, you are probably taking Value1 instead of Value in the table box. I.e. you would see the right values in Value field. Also note, in table box you would not see all the values. You should look at the table view (Ctrl+T) instead to check if it is working fine.

sumanta12
Creator II
Creator II

Hi,

Use Previous function:

IF(LEN(VALUE)=0,PREVIOUS(VALUE),VALUE) AS NEW_VALUE

vignesh_s
Creator
Creator

thanks its wrikng

vignesh_s
Creator
Creator

thanksits working

if i use isNULL(Value) instead of len(value)=0 ,im nt geting the out put,canu explain why

trdandamudi
Master II
Master II

You are welcome...

Might be you don't have nulls and you have only blanks and that is the reason you are not getting the output. Nulls  are different from blanks. Give a try on the below and let me know:

If(IsNull(Value) OR Value='',Peek('Value'),Value1) as Value