Description
Exports a data row from the specified buffer of a DataWindow control, DataStore object, or DataWindowChild object to the JSON string. The exported JSON string will be a one-level plain JSON string. For details, see Plain JSON: one-level structure in Application Techniques.
Applies to
| 
                               DataWindow type  | 
                           
                               Method applies to  | 
                        
|---|---|
| 
                               PowerBuilder  | 
                           
                               DataWindow control, DataWindowChild object, and DataStore object, except for those with the Composite, Crosstab, OLE 2.0, or RichText presentation styles.  | 
                        
Syntax
PowerBuilder
string dwcontrol.ExportRowAsJson (long row {, DWBuffer dwbuffer})
| 
                               Argument  | 
                           
                               Description  | 
                        
|---|---|
| 
                               dwcontrol  | 
                           
                               A reference to a DataWindow control, DataStore, or DataWindowChild.  | 
                        
| 
                               row  | 
                           
                               A long value identifying the row of data to be exported. 1 indicates the first row. The following number is invalid: 0, a negative value, or a value greater than the row count.  | 
                        
| 
                               dwbuffer (optional)  | 
                           
                               A value of the dwBuffer enumerated datatype identifying the DataWindow buffer from which you want to export the data. For a list of valid values, see DWBuffer. If not specified, exports the data from the Primary! buffer. If specified, exports the data from the specified buffer.  | 
                        
Return value
String. Returns the JSON string if the data row was exported successfully. Returns the empty string ("") if an error occurs or illegal row number (0, a negative value, or a value greater than the DataWindow row count) is specified.
The method returns null if any of the following:
- 
                     
any argument's value is null
 - 
                     
the DataWindow object (dataobject) is invalid
 - 
                     
the DataWindow presentation style is unsupported, such as Composite, Crosstab, OLE 2.0, or RichText
 
Usage
The Number data type is handled as Double data type; 15 digits of precision is supported; and it will be written in scientific notation if it exceeds 15 digits.
The Decimal{0} data type is handled as Double data type; it has no fractional part, and the digits in the fractional part (if any) will be rounded to the integral part; 15 digits of precision is supported; and it will be written in scientific notation if it exceeds 15 digits.
The Decimal{n} data type is handled as Double data type; it can have n digits in the fractional part, and the following digits (if any) will be rounded; 15 digits of precision is supported; and it will be written in scientific notation if it exceeds 15 digits.
Example
The following example exports the last row of data from the delete buffer.
String ls_ExportRowAsJson If dw_Data.GetRow() > 0 Then ls_ExportRowAsJson = dw_Data.ExportRowAsJson(dw_Data.GetRow()) // Exports the last row in delete buffer dw_Data.DeleteRow(dw_Data.GetRow()) ls_ExportRowAsJson = dw_Data.ExportRowAsJson ( dw_Data.DeletedCount( ), Delete! ) End If
See also


