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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to load file with 26 fields but only load unique records based on three fields

I have a file on our ERP system named PRTLST that contains a complete part listing with all details for standard costs

i would like to load this entire file and save as a QVD however there are many duplicates

How can i sort three fields acsending (PartNumber, [Commodity Code],STATUS) then script in to only pull in Unique records?

is this possible in Stage one or must this be done in a two stage process?

13 Replies
Not applicable
Author

I tried the below and i am getting unique record combinations.

However one more step would be greatly appreciated.

If a Part number has three different combinations such as Status Codes and Commodity Codes as seen below, how can i script Qlikview to only select the first record. which has been sorted ascending.

Part Number Item Status Commodity Code
6551-2461093
6551-2464OBP
6551-2464093


Itemtemp:

LOAD

[Part Number],

[Item Status],

[Commodity Code],

recno() as Recno

FROM $(Stage2QVDPath1)\ItemMaster.qvd(qvd);



Itemtemp2:

JOIN (Itemtemp)

LOAD DISTINCT

min(Recno) as Recno,

[Part Number],

[Item Status],

[Commodity Code]

RESIDENT Itemtemp

GROUP BY [Part Number],[Item Status],[Commodity Code]

ORDER BY [Part Number]ASC,[Item Status]ASC,[Commodity Code]ASC;



rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Not applicable
Author

Yes, i have researched and cant seem to find solution.

and, since i am new it appears that each time i was unable to communicate my exact problem in a clear enough manner to receive a to the point solution or help and i didnt PM anyone because i know that a lot of times it is recommended to post in forums so other can learn too.

I think i got the issue clearly explained in the third thread but can not script the correct solution.




johnw
Champion III
Champion III

So you only want to keep unique records based on ONE field instead of three, but sorted in the order of the three? Perhaps something like this:

Itemtemp:
LOAD
[Part Number]
,[Item Status]
,[Commodity Code]
, your other 23 fields
FROM $(Stage2QVDPath1)\ItemMaster.qvd(qvd);

INNER JOIN (Itemtemp)
LOAD *
RESIDENT ItemTemp
WHERE [Part Number]<>previous([Part Number])
ORDER BY [Part Number], [Item Status], [Commodity Code];