i've included the c/al code for a custom field in our navision database.
Was hoping someone would know how to calculate this in jet
CalcLastSaleDate() : Date
ItemLedgEntry.RESET;
ItemLedgEntry.SETCURRENTKEY("Source Type","Entry Type","Item No.","Posting Date");
ItemLedgEntry.SETRANGE("Source Type",ItemLedgEntry."Source Type"::Customer);
ItemLedgEntry.SETRANGE("Entry Type",ItemLedgEntry."Entry Type"::Sale);
ItemLedgEntry.SETRANGE("Item No.","No.");
IF ItemLedgEntry.FIND('+') THEN
LastDate := ItemLedgEntry."Posting Date"
ELSE
LastDate := 0D;
EXIT(LastDate);
4 comments
-
Jet Reports Historic Posts How about…
=NL("Last","Item ledger entry","Posting date","+Source type","Customer","+Entry type","Sale","+Item No.",CellRefToItemNo,"+Posting date","*") -
Jet Reports Historic Posts starting building the report as you entered below. Not sure what "Last" is and when i put it in, it #VALUES! out the report
also, not sure what you mean by CellRefToItemNo and why the posting date is in there again..
and the *?
=NL("Last","Item ledger entry","Posting date","+Source type","Customer","+Entry type","Sale","+Item No.",CellRefToItemNo,"+Posting date","*")
Any other suggestions?
Someone has to already have this report written. lol -
Jet Reports Historic Posts Last is to get the last record of a set of records. It equals the ItemLedgEntry.FIND('+') in the C/Al code. And * is to allow you to sort on a field without filtering. And the posting date is in there to get the exact sorting as in the ItemLedgEntry.SETCURRENTKEY("Source Type","Entry Type","Item No.","Posting Date") statement. CellRefToItemNo is my description of "Put the cell reference to the Item no in here please".
In the Help file you may read about Last on page 190, about Sorting and * on page 76. May I suggest to read the Help first - it's very useful :) -
Jet Reports Historic Posts If using NL("Last") gives you #Value, you may not be on the latest version of Jet Reports. I'm not in the office right now, so I can't look it up, but I believe that "Last" was added in version 5. If you are on a version earlier than this, then you could use NL("-1") instead. This is the old form of "Last" and "1" meant "First".
Triva question of the day.
Q) What would you use if you wanted the second to the last record in the example above?
A) NL("-2","Item Ledger Entry","Posting Date"…)