Previous Topic

Next Topic

FD Tutorial: Dashboard Cash

Using the Form Designer, you can create a dashboard to show graphs and list key figures for your company. This tutorial requires the AP Module.

This tutorial will show you how to display an analysis of expenses for a range of periods.

  1. Go to Navigator > Setup > Form Designer.
  2. Click the UserMemoryTable Memory Table button, then click inside the form on the right. A Memory Table object will be added to the form. The memory table object will not be displayed when the form runs, so it doesn't matter where you put it.
  3. Click the memory table icon on the form. The properties will be listed on the left.
  4. Change the Name of your table to tblCash.
  5. Double-click the Memory Table icon on your form. The FD Memory Table Designer will open.
  6. Add the following fields to the table:

    No.

    Name

    Display Label

    Type

    Domain

    Size

    Width

    Visible

    1

    BankAccount

    Account

    String

    CB Bank Account Code

    8

    8

    Selected

    2

    CurrencyCode

    Currency

    String

    Description

    60

    10

    Selected

    3

    CBBalance

    Balance

    Float

    Amount

     

    10

    Selected

    4

    CBBalanceBs

    BalanceBs

    Float

    Amount

     

    10

     

  7. Click Save. The FD Memory Table Designer will close.
  8. Set the Active property of the Memory Table to True.
  9. Click the UserListGrid List Grid button, then click inside the form on the right. A List Grid will be added to the form.
  10. Click the List Grid on the form, to show the properties on the left.
  11. Change the Name of the grid to gridCash.
  12. To change the display of the grid, set the following properties:

    Property

    Value

    Description

    Height

    200

    Sets the grid height. You can also drag to change the height.

    Left

    25

    Moves the grid to the left of the form.

    Top

    30

    Sets the grid position from the top. You can also drag to change the position.

    Width

    200

    Sets the grid width. You can also drag to change the width.

  13. Set the graph Table property to tblCash. This links the grid to the memory table created previously.
  14. Click the UserGridNavigator Grid Navigator button. Click beside the List Grid to add a navigator next to the grid.
  15. Change the Name of the navigator to navCash.
  16. Change the following properties of the grid navigator.

    Property

    Value

    Description

    Height

    200

    Sets the navigator height. You can also drag to change the height.

    Left

    0

    Moves the navigator to the left of the form.

    Top

    30

    Sets the grid position from the top. You can also drag to change the position.

    Visible Buttons

    ebOpen

    ebPrint

    ebFilterSort

    ebCustomise

    Select the buttons to show on the grid navigator. Set the buttons listed to True, all others to False.

    Width

    25

    Sets the grid width. You can also drag to change the width.

  17. Set the Table to tblCash. This links the grid to the memory table created previously. Set the Hook Control to gridCash, to link the navigator to the grid.

    You can now write the MaxBasic code to populate the Memory Table and graph.

  18. Enter the following code, to extract the expense information and populate the memory table, and display it in the grid:

    Sub RefreshCash
    Dim tblCBBank as Object
    tblCBBank = OpenTable("CBBank")
    tblCBBank.IndexName = "ActiveBank"
    tblCash.Empty
    tblCash.AllowInsertDelete = True
    tblCBBank.First
    Do Until tblCBBank.EOF
    tblCash.Append
    If tblCBBank.Inactive = False Then
    tblCash.BankAccount = tblCBBank.BankAccountCode
    tblCash.CurrencyCode = tblCBBank.CurrencyCode
    tblCash.CBBalance = tblCBBank.CashBookBalance
    tblCash.CBBalanceBs = tblCBBank.CashBookBalanceBs
    tblCash.Save
    End If
    tblCBBank.Next
    Loop
    tblCash.AllowInsertDelete = False
    tblCash.First
    End Sub

  19. Create a routine called OnCreate to run when the form is created. This will call the RefreshExpenses sub-routine. Enter the following code:

    Sub OnCreate
      RefreshCash
    End Sub

  20. Click the Layout tab. Click on the form, or select the frmFDForm component.
  21. Go to the Events tab. Set OnCreate to OnCreate.
  22. Add the following code to enable the Open and Print buttons:

    Sub OnNavCash(Sender as Object, Button as Number, ByRef Handled as Boolean)

    Dim Report as Object

    If Button = ebOpen Then

    Dim Form1 as Object

    Form1 = CreateObject("Accredo.CBBankAccountForm")

    Form1.Find(tblCash.BankAccount)

    End If

    If Button = ebPrint Then

    Report = CreateReport(tblCash, " Bank Account Balances ")

    Report.Destination = "Screen"

    Report.Run

    Handled = True

    End If

    End Sub

  23. Go to the layout tab. Select the navCash component. Go to the Events tab. Set OnClick to OnNavCash.
  24. You can add a label as a title to the graph. Click the UserLabel Label button, then click on the form.
  25. Change the Caption to Cash.
  26. You can change label size, position, font, colour or other properties.
  27. Click ReportSaveToDisk Save Form (Ctrl+S).
  28. Click Run (Ctrl+R) to test the form.

See Also

FD Dashboard Tutorials

Book Contents

Book Index