Tuesday, April 7, 2015

Dynamics NAV 2013 - Reporting Tricks


  • Display dynamics report values in the Page Header
    • Create a placeholder with a formula of =ReportItems!MatrixfieldName.Value where Matrixfieldname is the actual textbox name of a field on your report
    • The function will display whatever value you have in that field
  • Get the sum of group values, and not the sum of every single detail value
    • =Sum(Max(Fields!MyField.Value,"MyGroupName"))
  • Use CAL code to populate variables OnAfterGetRecord of your desired record
    • Try to use regular table joins to get to the most detailed level of your report first
      • Use CAL to grab additional information at each stage of the join
      • Use SSRS row hiding rules to hide the invalid detail lines for each header
    • Find the record and populate a variable
      • Itm.SETRANGE("No.","Item No.");
      • IF Itm.FIND('-') THEN
      • ItemDesc := Itm.Description;
      • You need to use a repeat until loop if you are getting more sub-records
    • Create a DataItem group named  Integer at the indentation level you need for your record details
      • Type in the variable name MatType as a DataSource and Name in the Report Dataset Designer
      • click on properties, set Maxiteration to 1
      • Use this column on your layout report
      • Create Subgroups if you are getting more sub-records
  • Set Default Report Filters
    • On Report, DataItem header
    • Populate the ReqFilterfields property
  • Get filter value and display on report
    • ILEFilter :=Item.GETFILTER("Location Filter"); 
  • Open Report with default set in Request page = current selected record on page
    • Example
      • GiftRec := Rec;
      • GiftRec.SETRANGE("No.",GiftRec."No.");
      • REPORT.RUNMODAL(50010,TRUE,TRUE,GiftRec);
  • To Get the fieldcaption of any field to display as a label that will change with language changes
    • Create a field in the report source using this formula
    • "Sales Line".FIELDCAPTION("Location Code")
  • To hide or skip records based on a request page parameter
    • Bank Account Ledger Entry - OnPreDataItem()
    • IF ShowUnmatched = FALSE THEN
    •   CurrReport.SKIP;

No comments:

Post a Comment