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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
shanmathytitu
Partner - Contributor III
Partner - Contributor III

auto number use cases clarification;

t2:

Load *,

Pnumber,

Prodnamecode,

autonumber(Pnumber & Prodnamecode )as keynum

from t1

order by date,

t3:

Load *,

AutoNumber(RecNo(),Autonumber(Autonumber(AutoNumber(keynum)))) as keynum1

resident t2;

t4:

Load *

from t3

where keynum1=1

order by date;

drop table t1,t2,t3;

 

What is the where clause restriction here and use of autonumber here. can you explain more in detail

Labels (3)
4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You have a nested AutoNumber() here that does not make sense to me, Can you explain what your objective is?

-Rob

shanmathytitu
Partner - Contributor III
Partner - Contributor III
Author

I am looking into one dashboard which has this code. I am trying to understand what was the motive to restrict only keynum1=1. Is that something for duplicate removal. I am not sure on that. i need someone help in understanding this multiple autonumber and its restriction.

marcus_sommer

Like Rob already mentioned it makes no sense to nest autonumber() multiple times and hints more for any mistakes by designing this application. The origin purpose is hard to guess - the most likely seems to be to create a counter for the frequency of the occurrence of the field-combination of Pnumber & Prodnamecode and only the first one remains an the others are removed from the where-clause.

You may just comment the condition to see the difference within the loaded data between both approaches ...

- Marcus  

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you are trying to restrict the rows to the first occurrence of Pnumber & Prodnamecode then you can simply do :

T1:
Load
  *
Where not Exists(keynum, keynum);
Load
  *,

  Hash128(Pnumber,  Prodnamecode )as keynum
from ...;

Drop Field keynum;

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com