Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
kbh0nick
Contributor
Contributor

Create Sequence Number


Hi,

I would like to add a grouped sequence number in the QlikView straight table and need some help.

I have the column A to F shown in the dimensions of a straight table and want to add a running sequence number expression that groups on only column A to C.

Please see the attached excel where I have manually added the sequence column. This column should not be there and should be generated in QlikView.

Please help. Thx!

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

Yes. You are correct. Sorry for giving an incorrect expression. Peek does not work in chart expressions. You should use 'Above' instead. An example is attached. Hope this helps.

View solution in original post

10 Replies
sushil353
Master II
Master II

Hi,

Try below code:

AutoNumber(rowno(),SAC.RouteDay) as Sequence

HTH

Sushil

tresesco
MVP
MVP

In the script, try like:

Load

          *,

          AutoNumber(RowNo(),WeekDayNo) as Sequence

From <>;

anbu1984
Master III
Master III

Load *,AutoNumber(RecNo(),SAC.AddressNumberSalesStaff&WeekNo&WeekDayNo) As NewSeq;

LOAD SAC.AddressNumberSalesStaff,

     WeekNo,

     WeekDayNo,

     SAC.AddressNumberCustomer,

     SAC.CustomerName,

     SAC.RouteDay,

     Sequence

FROM

(biff, embedded labels, table is Sheet1$);

its_anandrjs

You can try to add like

AutoNumber(rowno(),SAC.RouteDay) as Sequence

Or

AutoNumber(rowno(),WeekDayNo&SAC.RouteDay) as Sequence

Regards

Anand

MarcoWedel

LOAD *,

        AutoNumber(RecNo(),AutonumberHash128(SAC.AddressNumberSalesStaff,WeekNo,WeekDayNo)) as Sequence

FROM yoursource;

kbh0nick
Contributor
Contributor
Author

Thx all for the script! It works but I would like to be done in the expression of a straight table and there does not seem to have Autonumber function in expression.

I need it done in the expression because the user may filter the result and the expression can dynamically generate the sequence number.

Can advise further anyone?

nagaiank
Specialist III
Specialist III

The following script also works. If you want to implement Seq as chart expression, remove the preceding load in the script, sort the straight table by ID ascending and use the expression

If(Peek(SAC.RouteDay)=SAC.RouteDay,Peek(Seq)+1,1)

for your new sequence number column.

Data:

LOAD *,If(Peek(SAC.RouteDay)=SAC.RouteDay,Peek(Seq)+1,1) as Seq;

LOAD SAC.AddressNumberSalesStaff,

     WeekNo,

     WeekDayNo,

     SAC.AddressNumberCustomer,

     SAC.CustomerName,

     SAC.RouteDay,

     Sequence,

     RecNo() as ID

FROM

(biff, embedded labels, table is Sheet1$);

kbh0nick
Contributor
Contributor
Author

Hi NagaianK,

Just tried in expression but Peek does not seem to be recognized in expression. Are you able to provide an example in qlikview?

nagaiank
Specialist III
Specialist III

Yes. You are correct. Sorry for giving an incorrect expression. Peek does not work in chart expressions. You should use 'Above' instead. An example is attached. Hope this helps.

View solution in original post