Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
Not applicable

Fill a field when empty with previous value

Hi

I have a table like this:

Field1,     Field2

1,               A

2,              

3,              

4,               B

5,              


So field2 is empty in rows 2,3 and 5.

I wish to get a field3 where if row in field2 is empty it takes the value before in field3, and if not it takes the value in field2, resulting this:

Field1,     Field2,     Field3

1,               A              A

2,                               A

3,                               A

4,               B              B

5,                               B


How can do it as easy as possible?


Thnaks

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Fill a field when empty with previous value

Maybe like

LOAD Field1,

        If( Len(Trim(Field2)), Field2, Peek(Field3) ) as Field3

FROM YourTable;

View solution in original post

4 Replies
Highlighted
Chanty4u
Esteemed Contributor III

Re: Fill a field when empty with previous value

Highlighted
MVP
MVP

Re: Fill a field when empty with previous value

Maybe like

LOAD Field1,

        If( Len(Trim(Field2)), Field2, Peek(Field3) ) as Field3

FROM YourTable;

View solution in original post

Highlighted
Chanty4u
Esteemed Contributor III

Re: Fill a field when empty with previous value

hi,wiz.PNG

Highlighted

Re: Fill a field when empty with previous value

Try this:

Table:

LOAD Field1,

  Field2,

  If(Len(Trim(Field2)) > 0, Field2, Peek('Field3')) as Field3;

LOAD * Inline [

Field1,     Field2

1,               A

2,             

3,             

4,               B

5,             

];


Capture.PNG