Types
This section contains complex type configurations. Their settings define complex structured objects — Complex types. These types can represent complex JSON objects. Complex types can have fields of other complex types or arrays of complex types.
Types are not independent connector objects. They are auxiliary objects, which cannot have relationships or participate in SELECT queries. You can’t implement CRUD operations for them.
You can use complex types to define:
- JSON object and JSON array fields in the connector objects
- JSON object and JSON array fields in other complex types
- stored procedure parameters for passing JSON object and JSON array values
- stored procedure result fields of JSON object and JSON array type
You can assign these complex types to the SubType settings in the Columns, Parameters, and Results sections.
Settings
A complex type declaration may contain the following settings:
Name
The name of the complex type.
Columns
The Columns section contains column configurations. Their settings define complex type fields.
Column configuration settings for complex types are almost identical to the column configuration settings for objects, except for some properties associated with operations that complex types don’t support. See the Columns section for the information about their settings.
Type Example
The following example demonstrates the InvoiceLineItem complex type from the TMetric connector. Here is the complex type configuration code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"Types": [
{
"Name": "InvoiceLineItemsType",
"Columns": [
{
"Name": "UnitCount",
"APIPath": "unitCount",
"DbType": "Decimal"
},
{
"Name": "UnitPrice",
"APIPath": "unitPrice",
"DbType": "Decimal"
},
{
"Name": "UnitAmount",
"APIPath": "unitAmount",
"DbType": "Decimal"
},
{
"Name": "Description",
"APIPath": "description",
"DbType": "String"
},
{
"Name": "ItemType",
"APIPath": "itemType",
"DbType": "String"
}
]
}
]
And here is how you define a column configuration for a field, storing JSON array of invoice line items:
1
2
3
4
5
6
7
8
9
{
"Name": "Items",
"APIPath": "items",
"DbType": "JsonArray",
"SubType": "InvoiceLineItemsType",
"Createable": false,
"Updateable": false,
"ExtendedRequest": true
}