JobLedgEntryRec.SETRANGE(Type,JobLedgEntryRec.Type::Resource); JobLedgEntryRec.CALCFIELDS("Resource Type"); JobLedgEntryRec.SETRANGE("Resource Type",JobLedgEntryRec."Resource Type"::Machine); JobLedgEntryRec.SETRANGE("Entry Type",JobLedgEntryRec."Entry Type"::Usage); JobLedgEntryRec.SETRANGE("Job No.","Job No."); JobLedgEntryRec.SETRANGE("Phase Code","Phase Filter"); JobLedgEntryRec.SETRANGE("Task Code","Task Filter"); JobLedgEntryRec.SETRANGE("Step Code","Step Filter"); JobLedgEntryRec.SETRANGE(Type,"Type Filter"); JobLedgEntryRec.SETRANGE("Posting Date","Date Filter"); JobLedgEntryRec.CALCSUMS("Total Price");
Comments
:?:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
RIS Plus, LLC
The problem is that Resource Type is a flowfield (lookup) which is not possible to use in a key.
Thats why I use CALCSUMS instead of CALCFIELDS.
When I run it an error occur saying that my filter includes a flowfield which is not possible.
This is why i'm stucked, because none trigges are runned when the entries are generated and therefore the only way to receive the information from the resource is to use a lookupfield.
If you have to be able to use the field in a CALCSUM, then you will have to change the job posting routine to populate the Resource Type instead of setting it as a flowfield, and put some code in the OnModify of the Resource table to update all ledger entries if the resource type is changed, or disallow the field to be changed if there are outstanding ledger entries, similar to the way you can't change the Base Unit of Measure on the Item if there are Item Ledger entries.
RIS Plus, LLC
Are there any other way to do this.
Copy the resultset to a tmp table and do the calcfield on that.
Or is that too slow? (This is for analysis purpose)
Any suggestions are welcome.
RIS Plus, LLC