Skip to main content
Version: 8.0

InsertQuery class

Level: advanced

The Namespace Terrasoft.Nui.ServiceModel.DataContract.

The InsertQuery data contract is used to add records to sections. The data is transferred to the DataService via HTTP by using the POST request with the URL.

// URL format of the POST query to add data to DataService.
http(s)://[Creatio application address]/[Configuration number]/dataservice/[Data fromat]/reply/InsertQuery

The InsertQuery data contract has a hierarchical structure with multiple nesting levels. In the Creatio application server part, the InsertQuery data contract is represented by the InsertQuery class of the Terrasoft.Nui.ServiceModel.DataContract namespace of the Terrasoft.Nui.ServiceModel.dll class library. However, for simplicity, the hierarchical structure of the InsertQuery data contract is conveniently presented as a JSON format object:

Structure of the InsertQuery data contract
{
"RootSchemaName":"[Root object schema name]",
"OperationType":[Record operation type],
"ColumnValues":{
"Items":{
"Added column name":{
"ExpressionType":[Expression type],
"Parameter":{
"DataValueType":[Data type],
"Value":"[Column value]"
}
}...
}
}
}

Properties

RootSchemaName

A string containing the name of the root object schema of the added record.

OperationType

Operation type is set by the QueryOperationType namespace Terrasoft.Nui.ServiceModel.DataContract namespace enumeration value. For the InsertQuery the QueryOperationType.Insert value is set.

Available values (QueryOperationType)

Select

0

Insert

1

Update

2

Delete

3

Batch

4

ColumnValues

Contains a collection of column values of the added record. Its ColumnValues type is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.

ColumnValues class

The Namespace Terrasoft.Nui.ServiceModel.DataContract.

The ColumnValues class has a single Items property that is defined as a collection of the Dictionary<string, ColumnExpression> keys and values. The key is a string with the added column title, and the value is the object with the ColumnExpression type defined in the Terrasoft.Nui.ServiceModel.DataContract namespace. The basic properties of the ColumnExpression class used when adding records, are given in table.

Properties

ExpressionType

The expression type that defines the value that will be contained in the added column. Set by the EntitySchemaQueryExpressionType enumeration of the Terrasoft.Core.Entities namespace defined in the Terrasoft.Core class library. For the InsertQuery the EntitySchemaQueryExpressionType.Parameter value is set.

Available values (EntitySchemaQueryExpressionType)

SchemaColumn

0

Schema column.

Function

1

Function.

Parameter

2

Parameter.

SubQuery

3

Subquery.

ArithmeticOperation

4

Arithmetic operation.

Parameter

Defines the value that will be contained in the added column. Its Parameter type is defined in the Terrasoft.Nui.ServiceModel.DataContract namespace.

Parameter class

The Namespace Terrasoft.Nui.ServiceModel.DataContract.

The Parameter class has multiple properties, two of which are used to add records.

Properties

DataValueType

The data value type that defines the value that will be contained in the added column. Set by the DataValueType enumeration value of the Terrasoft.Nui.ServiceModel.DataContract namespace.

Available values (DataValueType)

Guid

0

Text

1

Integer

4

Float

5

Money

6

DateTime

7

Date

8

Time

9

Lookup

10

Enum

11

Boolean

12

Blob

13

Image

14

ImageLookup

16

Mapping

18

Value

The object that contains the added column value.