In a form's grid
control, along with the normal data source columns, if you want to show some
calculated/computed column as well then you can use a display method for that
purpose.
First, create a display method in a form's data source. The sample code for the display method is:
public display Str60 getTotalRecordsCount(MyTableName _myParamTableName)
{
MyAnotherTable myAnotherTable ;
//Select count of specific records in a table
select count(RecId) from myAnotherTable
where myAnotherTable.myTableNameRefRecid == _myParamTableName.RecId;
// Return that count
return int642str(myAnotherTable .RecId);
}
To utilize this method, add a new StringEdit field in the grid. Set the properties for this StringEdit control i.e. mention the above mentioned method name in the DataMethod Property. Mention the form's data source name (which will be passed as a parameter to this display method) in the DataSource property.
Mentioning the DataSource property is necessary to show correct data.
Also the return type of the display method is intentionally not set to "str" , here the return type is "Str60". Making the return type as "str" will increase the grid rows height.