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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loop with autofill?

Hi,

I have a simple loop - see attachement - that are returning values for a prognosis calculation. I had to loop this to be able to connect to other tables, because there's no useful dates in the table, just a date when the post is created.

One value should be used until a new value appear in that column, like:

P12     a     b

P1       -     -

P2       c     d

P3       -     -

and so on. So the value for P1 should be the last recorded = P12 and for P3 = P2

So I must have the loop to "autofil" the last existing values where the fields are empty or null. Like:

P12     a     b

P1       a     b

P2       c     d

P3       c     d

and so on...

Is there a way to do that?

/@Ungvall

Labels (1)
1 Solution

Accepted Solutions
rbecher
Partner - Master III
Partner - Master III

Hi Torbjörn,

just to give you an idea, this works:

base:

LOAD * INLINE [

    F1, F2, F3

    P12, a, b

    P1, ,

    P2, c, d

    P3, ,

];

autofill:

LOAD F1 as Field1,

if(IsNull(F2) or Trim(F2)='', peek(Field2), F2) as Field2,

if(IsNull(F3) or Trim(F3)='', peek(Field3), F3) as Field3

Resident base;

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

1 Reply
rbecher
Partner - Master III
Partner - Master III

Hi Torbjörn,

just to give you an idea, this works:

base:

LOAD * INLINE [

    F1, F2, F3

    P12, a, b

    P1, ,

    P2, c, d

    P3, ,

];

autofill:

LOAD F1 as Field1,

if(IsNull(F2) or Trim(F2)='', peek(Field2), F2) as Field2,

if(IsNull(F3) or Trim(F3)='', peek(Field3), F3) as Field3

Resident base;

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine