Kbase P68911: How to export contents of an SDO
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  09/07/2004 |
|
Status: Unverified
GOAL:
How to export contents of an SDO
GOAL:
How to write SDO contents to a file
FIX:
To do this, one would want to dump out the contents of the rowobject temp-table of the SDO.
The catch is that a simple FOR EACH RowObject loop is not going to work outside of an SDO master .w file, as procedures external to that will usually not have the static definitions for the temp-table.
Using a simple FOR EACH will mean having to update and recompile/redeploy all SDO masters (and possibly additional support files) that contain the export function each time the logic changes. As such data exporting logic will usually be used in multiple SDOs this is will quickly become a cumbersome task.
A better solution would be to build a generic procedure that does the following:
- Get the handle of the RowObject temp-table of an SDO (using the getRowObjectTable function).
- Use a dynamic query to loop through the records in the RowObject temp-table.
- For each record, loop through the buffer-field objects and determine the formatted output based on the STRING-VALUE and WIDTH-CHARS attributes. Take care to skip the fields the user should not see, such as the SDO internal fields.
- Write the formatted data to a printer or text file using basic file I/O (OUTPUT TO ...)
While this procedure can be placed anywhere in the application where a handle to the SDO can be obtained, it is advised to place it in a customization on the data.p class or in an SDO subclass. That way all SDOs will inherit the functionality and it can be called from wherever a handle to the SDO can be obtained.
Also, be aware that this technique only exports the records currently batched in the SDO. The easiest way to ensure all relevant records are batched in the SDO is by setting the rowsToBatch property to 0 and refreshing the SDO.