How do I print unique records from a table

pvarpvar Member Posts: 157
edited 2006-08-16 in Navision Attain
Hi,

I have a dataitem on a report that linked to a table that has duplicate records. I want to print only unique records from the table. How do I achieve that? Thanks

Comments

  • Joe_LittleJoe_Little Member Posts: 45
    If there is a key available with the values that you want, this is pretty easy. You can set the key and then use the group footer. This will only really work if the value that you want is the left most part of the key.

    For example, you could print one document number for any number of sales order lines as follows:

    With salesline do
    setcurrentkey("document type","document no.");
    setrange("document type","document type"::order;
    setrange("document no.","document no.");
    find("+'); // Skip to last record with this document number.
    setrange("document no."); // Reset the document number filter
    end;

    Put this in the onaftergetrecord of a report and it will only show you one occurance.

    This works because the free variable is the last in the key. If you don't have this available, you can create a temporary record which you need to manually fill. Then, use an integer record in the report rather than the the actual table (unfortunately Navision does not support temporary records directly as report elements).

    Good luck :D
Sign In or Register to comment.