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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Interesting QlikView data manipulation challenge

Hi fellow Qlikview devlopers,

I have intersting data manipulation challenge. I have simple column where data is broken in the following manner (table 1)

Table1:

Column1
A
B
C
A
B
A

I have to take table 1 and insert a new row above everytime i see the value A. The position of this new inserted row is very important (table 2).

Table2:

Column1
A
B
C
A
B
A

Please advise.

Thanks for your time.

Regards


Thomas.

Labels (1)
1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Something like this:

T1:

LOAD *, RowNo() as rowid INLINE [

    Column1

    A

    B

    C

    A

    B

    A

];

join

Load * inline [

Column1, Dummy

A, 1

A, 2

];

T2:

load if(Dummy=2,null(),Column1) as Column1, Dummy

Resident T1 Order by rowid, Dummy desc;

 

drop field Dummy;

drop table T1;


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Something like this:

T1:

LOAD *, RowNo() as rowid INLINE [

    Column1

    A

    B

    C

    A

    B

    A

];

join

Load * inline [

Column1, Dummy

A, 1

A, 2

];

T2:

load if(Dummy=2,null(),Column1) as Column1, Dummy

Resident T1 Order by rowid, Dummy desc;

 

drop field Dummy;

drop table T1;


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks a lot.