Hello NAV Experts,
I am having a problem in one of my reports
I have two tables in the Report Dataset designer:
Table A - Item table
-Table B - Integer table
In the Integer OnAfterGetRecord() trigger, there is a calculation.
If Variable = 0 then CurrReport.Skip.
My problem is that it only skips the Integer table record, but keeps the item information.
I need it to skip both the Item information and integer information for that record and then move onto the next record and do the check again.
Is there a way to just say at the OnPostReport() trigger, Something like: where field = SomeValue or sort by field. This has been the hardest and most frustrating part of NAV reports for me. Not being able to manipulate the final report dataset. (
https://msdn.microsoft.com/en-us/dynamics/nav/dn848439.aspx)
Thank you all for your help in advance !
Answers
If you want to skip the Item record then you should have SKIP function in Item.OnAfterGetRecord.
OnPostReport will be triggered executes after a report is run.
I have a report where I came across the same problem.
Report has these tables:
Item Table
-Sales Shipment Line Table
This report filters by date, location, and ship-to-code number.
When I run it for a certain ship-to-code number and export it to excel. All the items show up in the excel spreadsheet.
I can skip the sales shipment information by using below:
Sales Shipment Line - OnAfterGetRecord()
IF filterShipToCode <> '' THEN BEGIN
IF filterShipToCode <> SalesShipmentHeader."Ship-to Code" THEN CurrReport.SKIP;
END;
However, I cannot skip the items. The excel spreadsheet shows all the items.
I tried putting the code in the Item - OnAfterGetRecord() trigger, but then report shows up blank then.
How do I skip the items ?
I tried creating a variable, but the variable does not assigned until after the item is already displayed/generated. I tried putting this on post report trigger: SalesShipmentHeader.SETRANGE("Ship-to Code",filterShipToCode,filterShipToCode);
//so that it removes anything that is not the filterShipToCode (keep in mind i do not know how to use the setrange function).
I am so frustrated and lost, normally in VB, VBA, and even SQL. All I need to do is set a filter saying: where filterShipToCode <> ''
and since there is a relationship in the tables and the result is linear, it just skips the whole line.