Generating Constant Attribute Values

Generators are used to set values for constant attributes.

The autoGenerationPattern parameter during generation contains only a permanent part of the value. Use the autoGenerationPattern parameter to:

  1. Create a new generator or choose an existing one to be used for default values.
    Note: You can use UUID or SEQUENTIAL type of generator. If the generator is of type SEQUENTIAL and is used in other attributes, then each time the default value is generated, the value of the generator increases by one point. As a result, the order of values for attributes that contain a variable part can change. Therefore, it is better to use the UUID type of generator.
  2. Set auto-generation parameters for the required attribute in L3:
    {
      "label": "LabelString",
      "name": "TextField",
      "description": "Label string",
      "type": "String",
      "hidden": false,
      "important": false,
      "system": false,
      "required": false,
      "attributeOrdering": {
        "orderType": "ASC",
        "orderingStrategy": "LUD"
      },
      "uri": "configuration/entityTypes/HCP/attributes/TextField",
      "skipInDataAccess": false,
      "autoGenerated": true,
      "generateIfEmpty": true,
      "generateIfNotEmpty": true,
      "generator": "UUID_4",
      "autoGenerationPattern": "default generated string"
    }

The following table explains the format of the autoGenerationPattern parameter for different attribute types:

Table 1. Format of autoGenerationPattern
Type Example
String, Blob, URL Default generated string
Int, Float, Double, Long, Dollar 119
Boolean true
Date 20201030
Time, Timestamp 2020-10-30'T'12:37:02.011Z

Examples

L3

{
  "uri": "configuration",
  "schemaVersion": "1",
  "entityTypes": [
    {
      "uri": "configuration/entityTypes/Object1",
      "attributes": [
        {
          "label": "Object id",
          "name": "ID",
          "description": "",
          "type": "String",
          "hidden": false,
          "important": false,
          "system": false,
          "required": false,
          "searchable": true,
          "uri": "configuration/entityTypes/Object1/attributes/ID",
          "skipInDataAccess": false
        },
        {
          "label": "String",
          "name": "TextField",
          "description": "",
          "type": "String",
          "hidden": false,
          "important": false,
          "system": false,
          "required": false,
          "searchable": true,
          "autoGenerated": true,
          "generateIfEmpty": true,
          "generateIfNotEmpty": true,
          "generator": "UUID_4",
          "autoGenerationPattern": "Default generated string",
          "attributeOrdering": {
            "orderType": "ASC",
            "orderingStrategy": "LUD"
          },
          "uri": "configuration/entityTypes/Object1/attributes/TextField",
          "skipInDataAccess": false
        },
        {
          "label": "Integer value",
          "name": "Int",
          "description": "",
          "type": "Int",
          "hidden": false,
          "important": false,
          "system": false,
          "required": false,
          "searchable": true,
          "autoGenerated": true,
          "generateIfEmpty": true,
          "generateIfNotEmpty": true,
          "generator": "UUID_4",
          "autoGenerationPattern": 119,
          "attributeOrdering": {
            "orderType": "ASC",
            "orderingStrategy": "LUD"
          },
          "uri": "configuration/entityTypes/Object1/attributes/Int",
          "skipInDataAccess": false
        },
        {
          "label": "Boolean value",
          "name": "Boolean",
          "description": "",
          "type": "Boolean",
          "hidden": false,
          "important": false,
          "system": false,
          "required": false,
          "searchable": true,
          "autoGenerated": true,
          "generateIfEmpty": true,
          "generateIfNotEmpty": true,
          "generator": "UUID_4",
          "autoGenerationPattern": false,
          "attributeOrdering": {
            "orderType": "ASC",
            "orderingStrategy": "LUD"
          },
          "uri": "configuration/entityTypes/Object1/attributes/Boolean",
          "skipInDataAccess": false
        },
        {
          "label": "Date value",
          "name": "Date",
          "description": "",
          "type": "Date",
          "hidden": false,
          "important": false,
          "system": false,
          "required": false,
          "searchable": true,
          "autoGenerated": true,
          "generateIfEmpty": true,
          "generateIfNotEmpty": true,
          "generator": "UUID_4",
          "autoGenerationPattern": "20201030",
          "attributeOrdering": {
            "orderType": "ASC",
            "orderingStrategy": "LUD"
          },
          "uri": "configuration/entityTypes/Object1/attributes/Date",
          "skipInDataAccess": false
        },
        {
          "label": "Timestamp",
          "name": "Timestamp",
          "description": "",
          "type": "Timestamp",
          "hidden": false,
          "important": false,
          "system": false,
          "required": false,
          "searchable": true,
          "autoGenerated": true,
          "generateIfEmpty": true,
          "generateIfNotEmpty": true,
          "generator": "UUID_4",
          "autoGenerationPattern": "2020-10-30'T'12:37:02.011Z",
          "attributeOrdering": {
            "orderType": "ASC",
            "orderingStrategy": "LUD"
          },
          "uri": "configuration/entityTypes/Object1/attributes/Timestamp",
          "skipInDataAccess": false
        }
      ]
    }
  ],
  "sources": [
    {
      "uri": "configuration/sources/FB"
    },
    {
      "uri": "configuration/sources/HMS"
    }
  ]
}

POST {{api_uri}}/{{tenant}}/entities

[
  {
    "attributes": {
      "ID": [
        {
          "value": "001"
        }
      ]
    },
    "type": "configuration/entityTypes/Object1",
    "crosswalks": [
      {
        "type": "configuration/sources/FB",
        "value": "obj_gen"
      }
    ]
  }
]

Generated Values

[
  {
    "index": 0,
    "object": {
      "uri": "entities/nCNJ7ee",
      "type": "configuration/entityTypes/Object1",
      "createdBy": "tselezneva",
      "createdTime": 1604043619523,
      "updatedBy": "tselezneva",
      "updatedTime": 1604043619523,
      "attributes": {
        "ID": [
          {
            "type": "configuration/entityTypes/Object1/attributes/ID",
            "ov": true,
            "value": "001",
            "uri": "entities/nCNJ7ee/attributes/ID/1bhZOfWCC"
          }
        ],
        "TextField": [
          {
            "type": "configuration/entityTypes/Object1/attributes/TextField",
            "ov": true,
            "value": "Default generated string",
            "uri": "entities/nCNJ7ee/attributes/TextField/1bhZOfiyy"
          }
        ],
        "Int": [
          {
            "type": "configuration/entityTypes/Object1/attributes/Int",
            "ov": true,
            "value": "119",
            "uri": "entities/nCNJ7ee/attributes/Int/1bhZOfrVU"
          }
        ],
        "Boolean": [
          {
            "type": "configuration/entityTypes/Object1/attributes/Boolean",
            "ov": true,
            "value": "false",
            "uri": "entities/nCNJ7ee/attributes/Boolean/1bhZOg020"
          }
        ],
        "Date": [
          {
            "type": "configuration/entityTypes/Object1/attributes/Date",
            "ov": true,
            "value": "2020-10-30",
            "uri": "entities/nCNJ7ee/attributes/Date/1bhZOg8YW"
          }
        ],
        "Timestamp": [
          {
            "type": "configuration/entityTypes/Object1/attributes/Timestamp",
            "ov": true,
            "value": "2020-10-30T12:37:02.011+0000",
            "uri": "entities/nCNJ7ee/attributes/Timestamp/1bhZOgH52"
          }
        ]
      },
      "isFavorite": false,
      "crosswalks": [
        {
          "uri": "entities/nCNJ7ee/crosswalks/1bhZOfaSS",
          "type": "configuration/sources/FB",
          "value": "obj_gen",
          "reltioLoadDate": "2020-10-30T07:40:19.523Z",
          "createDate": "2020-10-30T07:40:19.523Z",
          "updateDate": "2020-10-30T07:40:19.523Z",
          "attributes": [
            "entities/nCNJ7ee/attributes/Boolean/1bhZOg020",
            "entities/nCNJ7ee/attributes/Int/1bhZOfrVU",
            "entities/nCNJ7ee/attributes/Date/1bhZOg8YW",
            "entities/nCNJ7ee/attributes/Timestamp/1bhZOgH52",
            "entities/nCNJ7ee/attributes/ID/1bhZOfWCC",
            "entities/nCNJ7ee/attributes/TextField/1bhZOfiyy"
          ],
          "singleAttributeUpdateDates": {}
        }
      ],
      "analyticsAttributes": {},
      "label": "",
      "secondaryLabel": ""
    },
    "successful": true
  }
]