Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

How to generate sequence number per change in a given field?

Hi all,

I have this problem.

I have a logical table in my application.

I want to generate Line_Number(seqNo) for each distinct value of Field "Doc_No".

So for example I want the Line_Number be generated like this:

Doc_NoLine_Number

K1000

10000
K100020000
K100030000

K1001

10000
K100120000
K100210000
K100220000
K100230000
K100240000
K100250000

Thanks in advance,

Kari

Tags (2)
1 Solution

Accepted Solutions
lironbaram
Honored Contributor II

Re: How to generate sequence number per change in a given field?

hi

check the attach file

hope it helps you

5 Replies
lironbaram
Honored Contributor II

Re: How to generate sequence number per change in a given field?

hi

check the attach file

hope it helps you

Not applicable

Re: How to generate sequence number per change in a given field?

Thanks,

works excellently.

Not applicable

Re: How to generate sequence number per change in a given field?

Thanks! Was looking for this too!

Not applicable

Re: How to generate sequence number per change in a given field?

Liron, I am unable to open the TEST.qvw file since I am running personal edition and I am out of recovery keys.

Anyhow hoping that you could post and explain your script here.

Any assistance would be appriciated

Thanks!

Re: How to generate sequence number per change in a given field?

Hi

Try like this

Load *, if(Previous(Doc_No)=Doc_No,numsum(peek('Line_Number'),1),1) As Line_Number from tableName;

Hope it helps