Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select first row of a grouped dimension in load script

Hi guys,

Consider the following script:

Load

     VendorId,

     EntryNo,

     Date,

     DocumentNo

Resident tbl_Vedors

Order By VendorId asc,

         EntryNo asc,

         Date asc;

and the result is as follows

VendorIdEntryNoDateDocumentNo
ABC0011234

03/01/2014

DOC_A_01
ABC001123403/01/2014ABB003
ABC001123404/01/2014ACC090914
ABC001123504/01/2014INV-001-222

....

My question is, how should I do it in load script if I want to get only the first row of every VendorId-EntryNo grouping (in yellow) ?

Thank you for your kind attention guys

Regards,

Khairul

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do it:

Load

     VendorId,

     EntryNo,

     VendorId & '-' & EntryNo As Key,

     Date,

     DocumentNo

Resident tbl_Vedors

Where Not Exists(Key, VendorId & '-' & EntryNo)

Order By VendorId asc,

         EntryNo asc,

         Date asc;


HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do it:

Load

     VendorId,

     EntryNo,

     VendorId & '-' & EntryNo As Key,

     Date,

     DocumentNo

Resident tbl_Vedors

Where Not Exists(Key, VendorId & '-' & EntryNo)

Order By VendorId asc,

         EntryNo asc,

         Date asc;


HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan,

It works!

Thank you very much for your kind attention

Regards,

Khairul