Difference between revisions of "ODATA CREATE()"

From Lianjapedia
Jump to: navigation, search
Line 1: Line 1:
 
''Under Construction''
 
''Under Construction''
 
==Purpose==
 
==Purpose==
Create a record
+
OData-compatible function to create a record
  
 
==Syntax==
 
==Syntax==
Line 11: Line 11:
 
==Description==
 
==Description==
 
The ODATA_CREATE() function is used to create a record.
 
The ODATA_CREATE() function is used to create a record.
 +
 +
{| class="wikitable" width="100%"
 +
!width="20%"|Parameter||width="20%"|Required||Description
 +
|-
 +
|valign="top"|<cURI>||valign="top"|Yes||valign="top"|The OData URI - see [[OData URIs]] for full details.
 +
|-
 +
|valign="top"|<cJSONdatastring>||valign="top"|Yes||valign="top"|JSON string containing the name/value pair(s) for the column(s) of the new record.
 +
|-
 +
|}
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
 +
// OData-compatible functions
 
odata_read("/southwind/shippers")
 
odata_read("/southwind/shippers")
 
odata_read("/southwind/shippers","readresults.txt")
 
odata_read("/southwind/shippers","readresults.txt")

Revision as of 10:40, 1 February 2017

Under Construction

Purpose

OData-compatible function to create a record

Syntax

ODATA_CREATE(<cURI>,<cJSONdatastring>)

See Also

APPEND BLANK, APPEND FROM, APPEND FROM ARRAY, DELETE (NoSQL), DELETE (SQL), INSERT, JSON_DECODE(), JSON_DECODE_FILE(), JSON_ENCODE(), OData Operators, OData URIs, ODATA_DELETE(), ODATA_READ(), ODATA_UPDATE(), PRINT_JSON(), SELECT, UPDATE

Description

The ODATA_CREATE() function is used to create a record.

Parameter Required Description
<cURI> Yes The OData URI - see OData URIs for full details.
<cJSONdatastring> Yes JSON string containing the name/value pair(s) for the column(s) of the new record.

Example

// OData-compatible functions
odata_read("/southwind/shippers")
odata_read("/southwind/shippers","readresults.txt")
? filetostr("readresults.txt")
 
cCreateString = '{"shipperid":4,"companyname":"Acme Inc.","phone":"(503) 555-1234"}'
odata_create("/southwind/shippers",cCreateString)
odata_read("/southwind/shippers")
 
cUpdateString = '{"phone":"(503) 555-5678", "__olddata":{"shipperid":4}}'
odata_update("/southwind/shippers",cUpdateString)
odata_read("/southwind/shippers")
 
cDeleteString = '{"shipperid":4}'
odata_delete("/southwind/shippers",cDeleteString)
odata_read("/southwind/shippers")