Using the display Method Modifier

The display method modifier is used to indicate that a method’s return value is to be displayed on a form or a report.
If you want users to edit the value in the control, use an edit method.
Use the display modifier on methods in the following:
  • Table methods
  • Form methods
  • Form data source methods
  • Report methods
  • Report design methods
Write your display methods on a table. You can use the same code in several forms or reports.
display methods are called each time the form is redrawn. They should not contain complex and time-consuming calculations.

Note
display methods can result in unintended information disclosure.
display methods are not activated if they are on a hidden tabbed page.
display methods can be cached. For more information about caching display methods, 


To create a display method, place the display keyword immediately in front of the method’s return type. For example:
display Amount amount()
display methods must have a return type. The return value is typically a calculated value (for example, a sum).
There should no parameters in a display method unless it is on a form data source where you must include the data source as a parameter. For example:
display InventQty accumulated(InventBudgetInvent Budget)

Note
You must use display on a form data source method when the return value is to be shown on a grid control.

To use a display method on a form or report control, the control and the return type of the method must have identical types. For example, if you have a RealEdit control on your form, the display method you are using must return a value of type real.
Add the display method to a form control.
  1. Set the DataSource property for the control to the data source that contains the method.
    If you do not set the DataSource property, the system assumes that the method has been defined on the form.
  2. Set the DataMethod property to the name of the method.
You might also want to set the ExtendedDataType or ArrayIndex properties:
  • If the ExtendedDataType property is set, formatting, Help text, and so on are inherited from the type specified here.
  • If the display method returns an array, set ArrayIndex to 0 to indicate that all array elements are to be shown in the control. If, for example, you set it to 2, only array element number two is shown.
Add a display method to a report control.
  1. Set the Table property for the control to the table that contains the method.
    If you do not set the Table property, the system assumes that the method has been defined on the report—the report design.
  2. Set the DataMethod property to the name of the method.























No comments:

Post a Comment