Consultor Eletrônico



Kbase P125483: How to create a Calculated field in a SmartDataBrowser with an extent table field?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/15/2007
Status: Verified

GOAL:

How to create a Calculated field in a SmartDataBrowser with an extent table field?

GOAL:

How to use a Calculated field using a extent field in a SmartDataBrowser

FIX:

Create the following within the SmartDataObject linked to the SmartDataBrowser as for example.
1. In the DEFINITION Section of the SmartDataObject.
DEFINE VAR imont AS INTEGER.
2. Create a Function in the SDO called GetQuota to calculate values for a calculated field.
RETURNS INTEGER
(INPUT csalesrep AS CHARACTER, INPUT imonth AS INTEGER):
/*------------------------------------------------------------------------------
Purpose: Returns the Quota of the Current month.
Notes:
------------------------------------------------------------------------------*/
FIND FIRST Salesrep WHERE salesrep.salesrep = csalesrep NO-LOCK NO-ERROR.
IF AVAILABLE salesrep THEN
RETURN salesrep.monthquota[imonth].
ELSE RETURN 0. /* Function return value. */
3. In the Calculated field Editor of the SmartDataObject place the following code.
GetQuota(rowobject.salesrep, imonth)
This example is created against the Sports2000 Database using the Salesrep table.