Coding a report

I have a report with two data items: Purch. Rcpt. Header and Purch. Rcpt. Line indented 1 space. In my report, if the receipt has been paid, I am attempting to get the Document Number and Posting Date from the Vendor Ledger Entry table and display it to the user as Check No. and Check Date. Trouble is my report is not filtering out inovices from the Vendor Ledger Entry table. My SETFILTER below does not seem to work. Because the first entry found is of type “Invoice”, I get Invoice numbers instead of Payment numbers. VendorLedgerEntry.SETFILTER(“Document No.”, PurchInvHeader.“No.”); //VendorLedgerEntry.SETFILTER(“Document Type”,‘Payment’); IF VendorLedgerEntry.FIND(’-’) THEN BEGIN VendorLedgerEntry2.GET(VendorLedgerEntry.“Entry No.”); EntryNo := VendorLedgerEntry2.“Entry No.”; CheckNo := VendorLedgerEntry2.“Document No.”; CheckDate := VendorLedgerEntry2.“Posting Date”; END; Is there a way to filter on “Document Type” of Payment in the table?

VendorLedgerEntry.SETRANGE(“Document Type”,VendorLedgerEntry.“Document Type”::Payment); The :: is called a scope operator. Happy reporting! [:)]

Thanks for the response, Nelson. Using this line of code: VendorLedgerEntry.SETRANGE(“Document Type”,VendorLedgerEntry.“Document Type”::Payment); I get an error stating “type conversion is not possible text := option.” Not sure why I am getting this.

Hi Stephen, You must have SETFILTER instead of SETRANGE - like in your first posting. Can you check the code? SETRANGE takes the same data type as the field you are filtering. SETFILTER takes a text string, hence the compile error.

Thanks Nelson, you were absolutely right. I changed the code to SETRANGE and the filter works.

Hi Stephen, This is all very well, but I’m very confused here as to what it is you’re trying to accomplish [?] First of all I don’t understand why your report is based on Purch. Rcpt. Header & -Line. Using Purch. Inv. Header & -Line seems a lot more logical - A Purchase Receipt doesn’t get paid (there’s no money involved) whereas an invoice does. Secondly the payment of an invoice will (most likely) not have the same Document No. (unless you actually use the Invoice No. as Document No. in the Journal) as the Invoice itself. Thus, the filter VendorLedgerEntry.SETRANGE("Document Type",VendorLedgerEntry."Document Type"::Payment); VendorLedgerEntry.SETFILTER("Document No.", PurchInvHeader."No."); although being correct syntax-wise, probably won’t give you the desired result. And by the way, here even more confusing, the variable is called PurchInvHeader. You might want to look at the fields “Applies-to Doc. Type” and “Applies-to Doc. No.” in stead - or maybe even “Applies-to ID” (but that’s another story). BTW there’s no reason to GET VendorLedgerEntry2, a simple assignment will do the job since you’ve already found the record. Anyway, I may have completely misunderstood your goal. If so, pls. feel free to ignore the above [;)]