Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

jblomqvist
Valued Contributor

How Can I restart my AutoNumber process after every new Company Code in the script?

Hello,

I have some data that looks like the following:

CompanyCode
YearMonthAutoNumberNEW AutoNumber
A2015-0111
A2015-0222
A2015-0333
B2015-0141
B2015-0252
C2014-1061
C2014-1172

My current AutoNumber expression in the script looks like:

AutoNumber(CompanyCode & '-' & YearMonth)

But it gives me a continues numbering like you see in the AutoNumber column example.

What I want to do is get my AutoNumber output to be like NEW AutoNumber column where it restarts after a new CompanyCode even if YearMonth values are similar.

Does anyone know how to do this please?

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

AutoNumber(CompanyCode & '-' & YearMonth, CompanyCode)

8 Replies

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

Just a minor remark: is the [NEW AutoNumber] value for the first CompanyCode=B row correct?

jblomqvist
Valued Contributor

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

Thank you for pointing that out! I have corrected the example

Highlighted
MVP
MVP

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

AutoNumber(CompanyCode & '-' & YearMonth, CompanyCode)

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

AutoNumber(YearMonth, CompanyCode)

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

If you just want to restart the counter in your load script, see this discussion and the example document: Numbering Rows more examples? One of the three methods fits your bill

Peter.

jblomqvist
Valued Contributor

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

Thank you so much Massimo you are a star!

jblomqvist
Valued Contributor

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

Thank you Marco for your reply

MVP
MVP

Re: How Can I restart my AutoNumber process after every new Company Code in the script?

Marco's answer is better than mine