[X++] Display methods on FormDatasource

Brief explanation

Display methods are written quickly and can run logic to calucalte values that can't be calculated with joins on forms.

They can appear on a form or a report. A display method is any method that includes the display keyword as a method modifier. You can use the display method modifier with the following kinds of methods:

  • Table methods
  • Form methods
  • Form data source methods
  • Report methods
  • Report design methods
Example normal display methods

A normal display method on a table has no parameters and returns a value:

display Qty myCalcQty()
{
   Qty calcQty = this.SalesQty + 5;
   return calcQty ;
}
On FormDataSources

When using display methods on FormDataSources keep in mind that they need a parameter of the same type as your DataSource is to get the record during runtime.
For example the total number of rows on CustTable:

display NumberOfRecords numRecords(CustTable myTable)
{
   NumberOfRecords recCount = this.totalNumberOfRows();
   return recCount;
}

Robin

Software Engineer / Application Developer

Subscribe to robsCode

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!