Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Naps_230
Creator
Creator

Help in script.......

Hi,

I have source table. T1.

     id,  name

    101, A

    102,

    103, B

    104, C

    105,

    106,

    107,

    108, T

    109, N

o/p table-

    id,  name

    101, A

    102, A

    103, B

    104, C

    105, C

    106, C

    107, C

    108, T

    109, N

Help in qlikview script.

-I have try my self this level.

T2:

lOAD id,

IF(name=' ',Previous(name),name) as name1

Resident T1;

drop table T1;

my o/p-

    id,  name

    101, A

    102, A

    103, B

    104, C

    105, C

    106,

    107,

    108, T

    109, N

I want to fill up null name with previous name.

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

you need just a little change to the script

when completing the values you want to reference the new column

try this

T2:

lOAD id,

IF(name=' ',peek('name1'),name) as name1

Resident T1;

drop table T1;

Vegar
MVP
MVP

There is a important difference between peek() and previous().

Previous() will consider the previous read row of your source table. In your case T1.

Peek() will consider the previous written row in your destination table. In your case T2.

When populating row with id 106 the previous() function will look at the empty name cell in T1. Peek will look att the last written cell value for 105 in T2 containing the value C.

You don't need to handle this in two steps you could write something like this:

T1:

LOAD

  id,

IF(len(name)>0,name,peek('name')) as name

INLINE [

  id,  name

    101, A

    102,

    103, B

    104, C

    105,

    106,

    107,

    108, T

    109, N

    ];

 

Cheers

Vegar Lie Arntsen

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.