December 2018
Beginner
210 pages
5h 7m
English
The previous example that iterated over the items listed all records in the Item table. If we don't need to retrieve all records from a table, but want to restrict the dataset to some specific records, we apply filters to the record. Two system functions exist for this purpose in C/AL: SETRANGE and SETFILTER. Let's take a look at an example of using both:
LOCAL PROCEDURE FindLastSalesInvoicePrice(ItemNo : Code[20]) : Decimal;VAR ValueEntry : Record 5802;BEGIN ValueEntry.SETCURRENTKEY("Item No.","Posting Date"); ValueEntry.SETRANGE("Item No.",ItemNo); ValueEntry.SETRANGE("Entry Type",ValueEntry."Entry Type"::"Direct Cost"); ValueEntry.SETRANGE("Item Ledger Entry Type",ValueEntry."Item Ledger Entry Type"::Sale); ValueEntry.SETFILTER("Sales ...Read now
Unlock full access