Kbase P93757: Refering to the RowObject buffer in a viewer leads to error 91
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  12/01/2005 |
|
Status: Unverified
SYMPTOM(s):
Directly referring to the RowObject buffer in the code of a visual object override (viewer or browser)
ADM2
** No RowObject record is available. (91)
CAUSE:
The SmartDataViewer (SDV) and SmartDataBrowser use a rowObject temp-table defined like the one used by their SDO data source. However queries are performed only on the rowObject temp-table of the SDO data source, and a data target visual objects never handle any query on its own rowObject temp-table. In other words, the SDO and the SDV do not share the same rowObject temp-table but have their own.
A set of API's like displayFields in src\adm2\viewer.p receive a list of data to display and populate the SCREEN-VALUE of the widgets, but it never refers to the RowObject buffer-fields directly.
FIX:
There are two options to solve this problem:
1) If the field RowObject.fieldIWantToReferTo is also displayed on the viewer, then rely on RowObject.fieldIWantToReferTo:SCREEN-VALUE ("character") or RowObject.fieldIWantToReferTo:INPUT-VALUE (same data type as the field itself). In others words use the visual widget rather than the buffer-field object.
Note that the fieldIWantToReferTo field can be hidden, it will still be populated by the SDO
2) If the field cannot be in the SDV, an option is to retrieve the handle of the SDO datasource and ask him about the value of a given field by using the columnValue API (see the code of columnValue in src\adm2\dataextcols.p)
Here is a little sample code to override displayFields: RUN SUPER( INPUT pcColValues).
/* The following code raises error 91, do not play with RowObject buffer...
rowObject.name:BGCOLOR IN FRAME fMAin =
IF rowObject.fieldIWantToReferTo MODULO 2 = 0 THEN 12 ELSE ?.
=> either use the widget level if fieldIWantToReferTo is in the SDV
or ask the SDO about the value you want*/
DEFINE VARIABLE hDataSource AS HANDLE NO-UNDO.
DEFINE VARIABLE iCustNumValue AS INTEGER NO-UNDO.
{get dataSource hDataSource}.
iCustNumValue = DYNAMIC-FUNCTION('columnValue':U IN hDataSource
,'CustNum').
/* Make name background color red if custnum is even */
rowObject.name:BGCOLOR IN FRAME fMAin = IF iCustNumValue MODULO 2 = 0 THEN 12 ELSE ?.