How to Transform a ListPlus Page Into a FactBox


In several places in NAV 2009 SP1, it has been used ListPlus pages in order to display two-dimension matrix. Those ListPlus Pages may be customized in order to be arranged as FactBoxes directly inside a main page (Document, Worksheet, etc.).

The main concept of those kind of two-dimensional matrix pages is that they have a Page Part with a List that is updated every time a value is changed in the analysis parameter bounded to fields and/or variables that belongs directly to the ListPlus.

This post will provide the basics on how to integrate the Item Availability by Location directly as FactBoxes instead of being called from RTC actions. The same concept may be applied to Item Availability by Period and Item Availability by Variant (and/or all of them together). In the example, the Planning Worksheet page is used as the main page.

listplus1

The next step will guide you through the modifications that need to be performed in order to arrange Page 492 “Item Availability By Location” as a FactBox. (In the standard Cronus this is called from an action present in the Related Information action group.)

  1. Rearrange Matrix Lines and configure Style property
    1. Design page 515 “Item Avail. by Location Lines”
    2. Below the Container line, add a new line of Field type. Fill in a name (e.g. “ItemNo”), a caption (e.g. “Item”) and populate SourceExpr property with Item.”No.” + ‘ ‘ + Item.Description
    3. Add some Style management: for this line change the Style property to “Favorable” and StyleExpr to TRUE

      listplus2

    4. In order to display in bold Matrix cells that contain values different from 0, add the following Boolean global variables (one for every possible Matrix Column). It is very important that for every Boolean variable, you also set the property (SHIFT+F4) “IncludeInDataset” to Yes.

      GRBool (for GrossRequirement StyleExpr)

      SRBool (for ScheduledReceipt StyleExpr)

      PORBool (for PlannedOrderReceipt StyleExpr)

      PABBool (for ProjAvailBalance StyleExpr)

      InvBool (for Item.Inventory StyleExpr)

      QPOBool (for Item."Qty. on Purch. Order" StyleExpr)

      QSOBool (for Item.”Qty. on Sales Order” StyleExpr)

      TOSQBool (for Item.”Trans. Ord. Shipment (Qty.)” StyleExpr)

      QTBool (for Item.”Qty. in Transit” StyleExpr)

      TORQBool (for Item.”Trans. Ord. Receipt(Qty.)” StyleExpr)

      EIBool (for ExpectedInventory StyleExpr)

      AvInvBool (for QtyAvailable StyleExpr)

      SRQBool (for Item.”Scheduled Receipt(Qty.)” StyleExpr)

      SNQBool (for Item.”Scheduled Need (Qty.)” StyleExpr)

      PORLBool (for PlannedOrderReleases StyleExpr)

      NetChBool (for Item.”Net Change” StyleExpr)

      listplus3 

    5. Create a new Function called “InitBoolean” and add this code:

      GRBool := GrossRequirement <> 0;

      SrBool := ScheduledReceipt <> 0;

      PORBool := PlannedOrderReceipt <> 0;

      PABBool := ProjAvailBalance <> 0;

      InvBool := Item.Inventory <> 0;

      QPOBool := Item."Qty. on Purch. Order" <> 0;

      QSOBool := Item."Qty. on Sales Order" <> 0;

      TOSQBool := Item."Trans. Ord. Shipment (Qty.)" <> 0;

      QTBool := Item."Qty. in Transit" <> 0;

      TORQBool := Item."Trans. Ord. Receipt (Qty.)" <> 0;

      EIBool := ExpectedInventory <> 0;

      AvInvBool := QtyAvailable <> 0;

      SRQBool := Item."Scheduled Receipt (Qty.)" <> 0;

      SNQBool := Item."Scheduled Need (Qty.)" <> 0;

      PORLBool := PlannedOrderReleases <> 0 ;

      NetChBool := Item."Net Change" <> 0;

    6. Add the Boolean value initialization in the OnAfterGetRecord() trigger at the bottom

      ExpectedInventory := AvailabilityMgt.ExpectedQtyOnHand(Item,TRUE,0,QtyAvailable,31129999D);

      END;

      InitBoolean; //Add this line

    7. For last, let this code work. In Page Designer, on each field for which you created a Boolean variable, change the Style property to “Strong” and in the StyleExpr property add the respective Boolean variable that you created in step d.
    8. Save and Compile the page.

     

  2. Add Availability by Location FactBox to Planning Worksheet.
    1. Design page 99000852 Planning Worksheet
    2. Go to last line and add a new Part type. Give this a name (e.g. IALL) and a caption (e.g. Availability By Location) and in the Properties for the line, fill in the PagePartID with “Item Avail. by Location Lines”
    3. Save and compile the page.

     

  3. Add the controls and code to update dynamically the Availability by Location FactBox
    1. Design page 99000852 Planning Worksheet
    2. Add these global variables
      Name DataType Subtype Length Option String
      ItemForIALL Record Item    
      Calendar Record Date    
      ItemPeriodLength Option     Day,Week,Month,Quarter,Year,Period
      AmountType Option     Net Change,Balance at Date
      ItemNo Code   30  
      DescDateFilter Text   30  
    3. Add the controls to manage the options for the Availability by Location FactBox by inserting those lines below the Container

      listplus4

      Type: Group, SubType: Group, Caption: Availability Options

      Type: Field, Caption: View by, SourceExpr: ItemPeriodLength, Style: Unfavorable, StyleExpr: TRUE

      Type: Field, Caption: View as, SourceExpr: AmountType, Style: Unfavorable, StyleExpr: TRUE

      Type: Field, Caption: Period, SourceExpr: DescDateFilter, Editable: FALSE

    4. Create a new Function called UpdateSubForm() and add this code

      ..

      IF ItemForIALL.GET(ItemNo) THEN BEGIN

        FindPeriod('',ItemForIALL);

        CurrPage.IALL.FORM.Set(ItemForIALL,ItemPeriodLength,AmountType);

      END;

    5. Create a new Function called FindPeriod() with these values:

      FindPeriod(SearchText : Code[10];VAR ItemRec : Record Item)

      On the FindPeriod function, add a local variable:

      Name DataType Subtype
      PeroidFormMgt Codeunit PeriodFormManagement

      And add this code to the FindPeriod function:

      IF ItemRec.GETFILTER("Date Filter") <> '' THEN BEGIN

        Calendar.SETFILTER("Period Start",ItemRec.GETFILTER("Date Filter"));

        IF NOT PeriodFormMgt.FindDate('+',Calendar,ItemPeriodLength) THEN

          PeriodFormMgt.FindDate('+',Calendar,ItemPeriodLength::Day);

        Calendar.SETRANGE("Period Start");

      END;

      PeriodFormMgt.FindDate(SearchText,Calendar,ItemPeriodLength);

      IF AmountType = AmountType::"Net Change" THEN BEGIN

        ItemRec.SETRANGE("Date Filter",Calendar."Period Start",Calendar."Period End");

        IF ItemRec.GETRANGEMIN("Date Filter") = ItemRec.GETRANGEMAX("Date Filter") THEN

          ItemRec.SETRANGE("Date Filter",ItemRec.GETRANGEMIN("Date Filter"));

      END ELSE

        ItemRec.SETRANGE("Date Filter",0D,Calendar."Period End");

      DescDateFilter := ItemRec.GETFILTER("Date Filter");

    6. Now you only need to add the code to let the Availability by location FactBox act like the original ListPlus page. To do so, you just have to copy paste those functions (and obviously code inside) from Page 492 “Item Availability by Location” and paste them into the functions of the Planning Worksheet page.

      PeriodItemPeriodLengthOnPush

      YearItemPeriodLengthOnPush

      QuarterItemPeriodLengthOnPush

      MonthItemPeriodLengthOnPush

      WeekItemPeriodLengthOnPush

      DayItemPeriodLengthOnPush

      NetChangeAmountTypeOnPush

      BalanceatDateAmountTypeOnPush

      DayItemPeriodLengthOnValidate

      WeekItemPeriodLengthOnValidate

      MonthItemPeriodLengthOnValidat

      QuarterItemPeriodLengthOnValid

      YearItemPeriodLengthOnValidate

      PeriodItemPeriodLengthOnValida

      NetChangeAmountTypeOnValidate

      BalanceatDateAmountTypeOnValid

    7. Once you have copied all this function, it’s needed to substitute all the FindPeriod(‘’); statement with FindPeriod(‘’,ItemForIALL); (You can simply use CTRL+H, Replace build in function).
    8. For refinement, you need to add in the OnOpenPage() trigger, in the bottom, this code

      ...

        ERROR('');

      ReqJnlManagement.OpenJnl(CurrentWkshBatchName,Rec);

      FindPeriod('',ItemForIALL); //Add this line

      And in the OnAfterGetRecord(); trigger, in the bottom, this code

      PlanningWarningLevel1OnFormat;

      ItemNo := "No."; //Add this line

      UpdateSubForm; //Add this line

    9. Save and compile the page.

     

  4. Add the Period Actions to browse through Periods in the Availability by Location FactBox
    1. Design page 99000852 Planning Worksheet
    2. Go to Last line(the first blank line) of the page and click SHIFT+F4 (edit Properties of the page)
    3. Change the property PromotedActionCategoriesML into ENU=New,Process,Reports,Availability Periods
    4. Close the Page properties window
    5. Go to last line of the page and click on View > Actions
    6. Go to last line and add one action group and two actions like these

      listplus5

      Type: ActionGroup, Caption: Availability

      Type: Action, Caption: Previous Period, Image: PreviousRecord, Promoted: Yes, PromotedCategory: Category4, ShortCutKey: CTRL+Q

      Type: Action, Caption: Next Period, Image: NextRecord, Promoted: Yes, PromotedCategory: Category4, ShortCutKey: CTRL+W

    7. Save and compile the page.

Right now you have completed all the steps necessary to create a FactBox for Item Availability by Location.

Attached you will find a .txt file with the example above, extended to Item availability by Location, by Period and by Variant too. Captions have been added for ENU and ITA.

These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

Best Regards,

Duilio Tacconi (dtacconi)

Microsoft Dynamics Italy

Microsoft Customer Service and Support (CSS) EMEA

ListPlusToFactBox.txt

Comments (0)

Skip to main content