Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jduluc12
Creator
Creator

Script to move values from one row to another

Hi,

My data looks as follows:

IDNoteHLType
1COPPHP
1 LP
2FPTTHP
2 LP
3T566HS
3T566LS

 

the value for the Note column is missing where

HL = L

and

Type = P

I want my data to look as follows:

IDNoteHLType
1COPPHP
1COPPLP
2FPTTHP
2FPTTLP
3T566HS
3T566LS

 

It is basically copying the value of the Note field (COPP) from the row where

ID = 1 and HL = H and Type = P

to the row where

ID = 1 and HL = L and Type = P

and so on like other rows.

Thanks 

Labels (1)
1 Solution

Accepted Solutions
mfchmielowski
Creator II
Creator II

Hi.

To achive this you can use previous() function. The key is to resident load the source table with specific order. For you it will be ID ASC, Note desc.

Something like

Noconcatenate Tmp:

Load ID, if(previous(ID) =ID and Note ='', previoud(Note), Note) as Note, HL, Type resident SourceTable order by ID ASC, Note desc;

Drop SourceTable; rename table Tmp to SourceTablr;

View solution in original post

1 Reply
mfchmielowski
Creator II
Creator II

Hi.

To achive this you can use previous() function. The key is to resident load the source table with specific order. For you it will be ID ASC, Note desc.

Something like

Noconcatenate Tmp:

Load ID, if(previous(ID) =ID and Note ='', previoud(Note), Note) as Note, HL, Type resident SourceTable order by ID ASC, Note desc;

Drop SourceTable; rename table Tmp to SourceTablr;

View solution in original post