Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

MVP
MVP

Re: Repeating values until null.

It seems that previous suggestion work; this is the result with the table you posted


1.png


Source:

LOAD

  rowno() as id,

  [Header 1],

    [Header 2]

FROM

[https://community.qlik.com/thread/211171]

(html, codepage is 1252, embedded labels, table is @1);

Final:

NoConcatenate LOAD

  If(Len(Trim([Header 1]))>0,[Header 1], Peek([Header 1])) as [Header 1],

    [Header 2]

Resident Source

Order By id;

DROP Table Source;

Re: Repeating values until null.

I think, Peek is working fine..

LOAD RecNo() as Key,
if( len(trim([Header 1]))=0, peek([Header 1]),[Header 1]) as [Header 1],
[Header 2]     
FROM
[https://community.qlik.com/thread/211171]
(
html, codepage is 1252, embedded labels, table is @1) where Len([Header 2])>0;

Capture.JPG

Employee
Employee

Re: Repeating values until null.

What Gysbert suggests should work.

If the values only repeat once and no more, then something else is wrong.

  • Check that you use Peek() and not Previous().
  • Check that the records are ordered correctly.
  • Check that Peek() contains the created field - the output field:
    If(Len(Trim([Header 1]))>0,[Header 1], Peek([Header 1])) as [Header 1]

See also How to populate a sparsely populated field

HIC

adnan_rafiq
Contributor II

Re: Repeating values until null.

Here is excel and qvw.

Re: Repeating values until null.

As Mentioned by HIC, you need to use the output field inside the Peek.

LOAD [Report number],

    Column,

    Numbers,

    if(len(trim([Report number]))=0,Peek([Peekedcolumn]),[Report number]) as Peekedcolumn

FROM

[Book1 (3).xlsx]

(ooxml, embedded labels, table is Sheet1);

Re: Repeating values until null.

LOAD if(len(trim([Report number]))=0,Peek([Report number]),[Report number]) as Peekedcolumn,

    Column,

    Numbers

FROM

...

You're peeking in the wrong field. Use peek(Peekedcolumn) or give the resulting field the name [Report number]


talk is cheap, supply exceeds demand
Highlighted

Re: Repeating values until null.

Another solution (Fill option (Transformation Wizard))

LOAD [Report number],

     Column,

     Numbers

FROM

[Book1 (1).xlsx]

(ooxml, embedded labels, table is Sheet1, filters(

Replace(1, top, StrCnd(null))

));

Output:

Capture.PNG

adnan_rafiq
Contributor II

Re: Repeating values until null.

Thanks Gysbert 

can you explain the logic.

Please

Re: Repeating values until null.

See this blog post: Peek() vs Previous() – When to Use Each


talk is cheap, supply exceeds demand
Community Browser