The Perfion Query – INSERT

The Insert statement creates new items. Here is an example:

XML:

<Query>    <Insert>       <Item brand='Normal'>          <Value>ABCD-123</Value>          <ItemName language='EN'>The good item</ItemName>          <Description language='EN'>A very good item</Description>          <Description language='DAN'>En meget god vare</Description>       </Item>      <Item brand='Normal'>          <Value>ABCD-321</Value>          <ItemName language='EN'>The good item 2</ItemName>          <Description language='EN'>A very good item 2</Description>          <Description language='DAN'>En meget god vare 2</Description>       </Item>    </Insert>    <From id ='Product'/> </Query>

JSON:

{    "Query": {       "Insert": {          "Items": [             {                "brand": "Normal",                "parentid": 0,                "values": [                   { "name": "Value", "value": "ABCD-123" },                   { "name": "ItemName", "language": "EN", "value": "The good item" },                   { "name": "Description", "language": "EN", "value": "A very good item" },                   { "name": "Description", "language": "DAN", "value": "En meget god vare" }                ]             },             {                "brand": "Normal",                "parentid": 0,                "values": [                   { "name": "Value", "value": "ABCD-321" },                   { "name": "ItemName", "language": "EN", "value": "The good item 2" },                   { "name": "Description", "language": "EN", "value": "A very good item 2" },                   { "name": "Description", "language": "DAN", "value": "En meget god vare 2" }                ]             }           ]       },       "From": { "id": "Product" }    } }

As can be seen, it looks very much like an Update-statements and works very much like it. But instead of updating existing items, it simply adds new items. Because it is creating new items, you can specify these two attributes/properties on each item element/object: 

brand

Specifies the brand of the item to be created (Normal or Virtual)

parentID

Specifies if the item is a child of an already existing item. Specifying a value of 0 will make a root-item. It is only possible to use Virtual Items as parent item