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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

For Next Loop

Hi,

please look at my example, I try to build a loop for becoming a new field. This table should be the result at the end of the loop...

ID / Objekt / Tmp_ID

1 / A / Null

2 / B / Null

3 / C / 3

4 / D / 4

5 / E / Null

Thanks

1 Solution

Accepted Solutions
consenit
Partner - Creator II
Partner - Creator II

Hi There.

Try this:

Tabelle:

LOAD * INLINE [

    ID, Objekt

    1, A

    2, B

    3, C

    4, D

    5, E

];

ID_Table:

LOAD * INLINE [

    ID

    1

    2

    5

];

LEFT JOIN (Tabelle) LOAD

  ID, 1 AS TempFlag

RESIDENT ID_Table;

Tmp_Tabelle:

  NOCONCATENATE LOAD

  ID, Objekt,

  IF(TempFlag, NULL(), ID) AS Tmp_ID

RESIDENT Tabelle;

drop Table Tabelle;

drop Table ID_Table;

Kind regards,

Ernesto.

View solution in original post

4 Replies
consenit
Partner - Creator II
Partner - Creator II

Hi There.

Try this:

Tabelle:

LOAD * INLINE [

    ID, Objekt

    1, A

    2, B

    3, C

    4, D

    5, E

];

ID_Table:

LOAD * INLINE [

    ID

    1

    2

    5

];

LEFT JOIN (Tabelle) LOAD

  ID, 1 AS TempFlag

RESIDENT ID_Table;

Tmp_Tabelle:

  NOCONCATENATE LOAD

  ID, Objekt,

  IF(TempFlag, NULL(), ID) AS Tmp_ID

RESIDENT Tabelle;

drop Table Tabelle;

drop Table ID_Table;

Kind regards,

Ernesto.

sunny_talwar

Why do you want to loop here? What Ernesto‌ has proposed should work well for you, unless that is not something you are looking for.

settu_periasamy
Master III
Master III

Hi,

One more solution:

Tabelle:
LOAD * INLINE [
ID, Objekt
1, A
2, B
3, C
4, D
5, E
]
;
 
Left Join(Tabelle)
LOAD *,1 as Temp_ID;
LOAD * INLINE [
ID
1
2
5
]
;

NoConcatenate
Final:
LOAD ID,Objekt,if(Temp_ID=1,NULL(),ID) as Temp_ID Resident Tabelle;
 
DROP Table Tabelle;

Not applicable
Author

That´s right. In the first moment I thought that I have to handle with loop.

Thanks!