Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Inverting AutoNumber

Hi

I want to invert the AutoNumber function. I have a list of forecast submissions where I want the latest submission date to be nr 1 and the oldest to be the highest number.

As it is now it is giving the latest submission date the highest number and the oldest nr 1. How do I write in the script to invert the numbering?

Thanks for any help!

4 Replies
datanibbler
Esteemed Contributor

Re: Inverting AutoNumber

Hi Fredrik,

do it in several steps, without the AutoNumber() function:

- Sort the table by submission_date in desc. order (to have the latest date on top)

- Create a recordno() field to number the records

=> You can still use AutoNumber() if you want, but the recordno() should do as well.

HTH

Best regards,

DataNibbler

pgrenier
Contributor III

Re: Inverting AutoNumber

Hello Fredrik,

The AutoNumber() fonction will create it's associated numeric values according to the order in which the different values of the expression received as a parameter are met. Simply preorder the data using a preceding load in the desired manner (latest vs oldest submission), and you shall have the desired result.

Regards,

Philippe

MVP
MVP

Re: Inverting AutoNumber

Hi Fredrik,

you could try this:

10000000 - AutoNumber(..)

Max. value depending on amount of records.

- Ralf

Re: Inverting AutoNumber

May be with the help Order By in descending

Load

     Field,

     SubmissionDate,

     Autonumber(FieldName) As FieldAutonumber

From Source

Order By SubmissionDate Desc;

Community Browser