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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
separerl
Contributor III
Contributor III

Group records over a number of rows

Hi !

I have a mission to import a file , with the recordlayout like this, and Create/Group records

The RecordType 10 states that this is a new record

RecordTypeValueRecordNo (this is the one I want to create when loading the file)
10Donald1
20Goofy road 41
3099221
10Daisy2
20Mickey road 52
10Scrooge3
20Abbey road 13
3012343
40London3

Any tips ?


Regards Pär

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

Try the following script:

load *,If(RecordType=10,If(IsNull(Peek(RecordNo)),1,Peek(RecordNo)+1),Peek(RecordNo)) as RecordNo;

load * Inline [

RecordType,Value

10,Donald

20,Goofy road 4

30,9922

10,Daisy

20,Mickey road 5

10,Scrooge

20,Abbey road 1

30,1234

40,London

];

View solution in original post

3 Replies
nagaiank
Specialist III
Specialist III

Try the following script:

load *,If(RecordType=10,If(IsNull(Peek(RecordNo)),1,Peek(RecordNo)+1),Peek(RecordNo)) as RecordNo;

load * Inline [

RecordType,Value

10,Donald

20,Goofy road 4

30,9922

10,Daisy

20,Mickey road 5

10,Scrooge

20,Abbey road 1

30,1234

40,London

];

rubenmarin

maybe something like:

if(RecordType=10, NumSum(1, Peek('RecordNo')), Peek('RecordNo')) as RecordNo;

separerl
Contributor III
Contributor III
Author

Thanks !

Works like a dream ....

/Pär