Use APIs to update attributes
- Last Updated: April 22, 2024
- 3 minute read
- Corticon.js
- Documentation
To update a particular attribute of an entity, you must get the entity to update, and
then access the attribute. To get the entity, use either
getAllEntities() or
getEntitiesByType(<stringEntityType>>).
Note: You need to use
getOperator()
for decimal, date, and dateTime attributes. Get the Entity to update
To update a particular attribute or association of an entity, you have to get the entity
you want to update, and then access the attribute. To get the entity, you can use either
getAllEntities() or
getEntitiesByType(<stringEntityType>) For example, to update
an Integer attribute of an Entity:
|
INTEGER
To update an integer attribute of an Entity:
|
BOOLEAN
To update a Boolean attribute of an Entity:
|
STRING
To update a String attribute of an entity, access the entity, and then update the
particular attribute of the entity to the preferred value:
|
DECIMAL
To update Decimal Attributes of an Entity, use the
getOperator() API to
access the Decimal operator helper functions. The decimal operator is accessed as shown:
|
You need to access the Decimal operator in Corticon.js, and then use its
helper functions. Once you have access to the decimal operator, you can use its
functions to update your attribute. For example, If you want to create a decimal value,
you can use the
constructDecimal operator:
|
To use other operators on a decimal data type, you can access the
operators available using
corticonDataManager.getOperator().decimal.
To use the decimal
add operator:
|
To use the decimal
lessThan operator:
|
Note: To see all the decimal helper
functions, link to Customized data access operators
.
DATE
To update Date Attributes of an Entity, you use the
getOperator() API
to get access to the Date operator helper functions. The date operator
can be accessed as shown:
|
For example, to update an attribute of type Date, you access the
date operator available in Corticon, and then use the helper
functions available. Once you have access to the date operator you can
use its helper functions to update your attribute. For example, to create a new
date value, use the constructDate operator:
|
To use other operators on a Date, you can access the operators available
using
corticonDataManager.getOperator().date For example, to use the
addDays operator:
|
This example wants to add 20 days to a date:
|
To use the date
lessThan operator:
|
To use the date
getMilliseconds operator:
|
Note: To see all the date helper functions, link to
Customized data access operators
.
DATETIME
To update DateTime Attributes of an Entity, you use the
getOperator()
API to get access to the DateTime operator helper functions. The
dateTime operator can be accessed as shown:
|
For example, to update an attribute of type DateTime, you access the
dateTime operator available in Corticon, and then use the helper
functions available. Once you have access to the dateTime operator you
can use its helper functions to update your attribute. For example, to create a new
dateTime value, use the constructDateTime
operator:
|
To use other operators on a DateTime, you can access the operators
available using
corticonDataManager.getOperator().dateTime For example,
to use the addDays operator:
|
This example wants to add 20 days to a dateTime:
|
To use the dateTime
lessThan operator:
|
To use the dateTime
getMilliseconds operator:
|
Note: To see all the dateTime helper
functions, link to Customized data access operators
.