Previous Topic

Next Topic

Book Contents

Book Index

Script to Default Graph Fields

This example shows you how to setup a script to default the Field Selections of a graph.

For this example we will set the default fields for the IC Product graph tab. A similar script could be set up for any graph tab.

  1. Open the Script Editor from Accredo > Script > Script Editor.
  2. Enter the following code. This will set the first graph field to SalesQuantity and the second graph field to SalesQuantityLastYear. You can change these to the fields you wish to default to.

    Dim frmICProd1 as Object

    frmICProd1 = GetTriggerObject

    if IsNull(frmICProd1) then frmICProd1 = GetActiveObject

    if IsNull(frmICProd1) or frmICProd1.ClassName <> "ICProductForm" then Error "Wrong form class for script"

    frmICProd1.GraphField = "SalesQuantity"

    frmICProd1.GraphField2 = "SalesQuantityLastYear"

    frmICProd1.ActivePage = 0

    frmICProd1.ActiveProperty = ""

  3. Save the script as ICProduct_SetGraphFields_OnOpen.pfs.
  4. Set the script to run when the IC Product form is opened. Go to Accredo > Script > Script Events. Click Edit (F11).
  5. Set the following:
  6. Click Save (F9).
  7. Now when you open the IC Product form, the graph tab will show the fields you have set.