Uses the contents of a temp-table to generate a JsonArray. The current contents of the JsonArray are removed.
Return type: LOGICAL
Access: PUBLIC
Applies to: Progress.Json.ObjectModel.JsonArray class
Read( INPUT TABLE-HANDLE tt-handle ) Read( INPUT TABLE-HANDLE tt-handle, INPUT omit-initial-values AS LOGICAL ) |
When working with large temp-tables, omitting fields containing their initial values can yield smaller JSON values, more efficient network transfers, and performance gains with the Read( ) method.
This behavior applies both to temp-table fields which have the default initial value for its data type, and for fields which have an initial value set with the ABL INITIAL option.
The ABL READ-JSON( ) method always populates created records with initial values from the temp-table or ProDataSet definition. Other applications might not do this.
When a temp-table handle is passed to JsonArray:Read( ), the JsonArray is set to a series of objects representing each row in the temp table. The following is a temp-table definition that is passed to JsonArray:Read( ):
DEFINE VARIABLE httCust AS HANDLE NO-UNDO. DEFINE VARIABLE myArr AS JsonArray NO-UNDO. DEFINE VARIABLE myLongchar AS LONGCHAR NO-UNDO. DEFINE TEMP-TABLE ttCust FIELD CustNum AS INTEGER FIELD Name AS CHARACTER FIELD NewCust AS LOGICAL. /* . . Load temp-tables . */ httCust = TEMP-TABLE ttCust:HANDLE. myArr = NEW JsonArray(). myArr:Read(TABLE-HANDLE httCust). myArr:Write(myLongchar, TRUE). |
The following is the resultant JSON construct tree, myLongchar: