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.
The Corticon.js Service Callout APIs to update attributes of entities are:

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:
function updateCargoEntity(corticonDataManager) {
const entities = corticonDataManager.getEntitiesByType('Cargo');
  entities.forEach(entity => {
      if(entity['container'] === 'oversize') {
          //Update the attribute value to something else
          entity['volume'] = 50;
      }
  });
}	

INTEGER

To update an integer attribute of an Entity:
function updateCargoEntity(corticonDataManager) {
const entities = corticonDataManager.getEntitiesByType('Cargo');
  entities.forEach(entity => {
      if(entity['container'] === 'oversize') {
          //Update the attribute value to something else
          entity['dispatched'] = false;
      }
  });
}	

BOOLEAN

To update a Boolean attribute of an Entity:
function updateCargoEntity(corticonDataManager) {
const entities = corticonDataManager.getEntitiesByType('Cargo');
  entities.forEach(entity => {
      if(entity['container'] === 'oversize') {
          //Update the attribute value to something else
          entity['dispatched'] = false;
      }
  });
}	

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:
function updateCargoEntity(corticonDataManager) {
const entities = corticonDataManager.getEntitiesByType('Cargo');
  entities.forEach(entity => {
      if(entity['container'] === 'oversize') {
          //Update the attribute value to something else
          entity['manifestNumber'] = '737FA0987';
      }
  });
}	

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:
corticonDataManager.getOperator().decimal	
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:
corticonDataManager.getOperator().decimal.constructDecimal('<value>');
For example,  
corticonDataManager.getOperator().decimal.constructDecimal('54.678'); 
//This will create a new decimal Object of value 54.678. 
//If you want to assign this to an attribute you can simply do as below
aircraftEntity['maxCargoWeight'] = corticonDataManager.getOperator().decimal.constructDecimal('54.678');
//The above code will create a decimal object and set the value of 'maxCargoWeight' to the 54.678

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:
aircraftEntity['maxCargoWeight'] = corticonDataManager.getOperator().decimal.add(aircraftEntity['maxCargoWeight'], '100.89');
//Adds 100.89 to the existing value of maxCargoWeight.	
To use the decimal lessThan operator:
corticonDataManager.getOperator().decimal.lessThan(aircraftEntity['maxCargoWeight'], '100.89');
//Will compare the if the first parameter is less than the second and return a boolean. 
//Returns true if the first parameter is lessThan second, else false. 
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:
corticonDataManager.getOperator().date	
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:
corticonDataManager.getOperator().date.constructDate('<value>');
//It accepts either a string which has to be an 
//ISO-8601 representation of a Date or a long value which represents the time since epoch in milliseconds.
For example,  
corticonDataManager.getOperator().date.constructDate('2021-11-11');
//This will create a new date Object with the above date . 
//If you want to assign this to an attribute you can simply do as below
aircraftEntity['manufactureDate'] = corticonDataManager.getOperator().date.constructDate('2021-11-11');
//The above code will create a date object and set the 'manufactureDate'	
To use other operators on a Date, you can access the operators available using corticonDataManager.getOperator().date For example, to use the addDays operator:
aircraftEntity['manufactureDate'] = corticonDataManager.getOperator().date.addDays('2021-11-11', 4);
//The first argument is a date dataType and the second argument is a number.
//The function will add 4 days to the date object and return the date object.	
This example wants to add 20 days to a date:
aircraftEntity['manufactureDate'] = corticonDataManager.getOperator().date.addDays(aircraftEntity['inspectionDate'], 20);
//The first argument is a date dataType and the second argument is a number.
//The function will add 20 days to the inspectionDate and set the manufactureDate value to inspectionDate + 20 days.
To use the date lessThan operator:
corticonDataManager.getOperator().date.lessThan(aircraftEntity['inspectionDate'], aircraftEntity['manufactureDate']);
//Will compare the if the first parameter is less than the second and return a boolean. 
//Returns true if the first parameter is lessThan second, else false.	
To use the date getMilliseconds operator:
corticonDataManager.getOperator().date.getMilliseconds(aircraftEntity['inspectionDate']);
//Will return the current date as milliseconds since epoch (Jan 1, 1970) 	
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:
corticonDataManager.getOperator().dateTime	
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:
corticonDataManager.getOperator().dateTime.constructDateTime('<value>');
//It accepts either a string which has to be an 
//ISO-8601 representation of a DateTime or a long value which represents the time since epoch in milliseconds.
For example,  
corticonDataManager.getOperator().dateTime.constructDateTime('2021-11-11T19:42:08+0000');
//This will create a new datetime Object with the above date . 
//If you want to assign this to an attribute you can simply do as below
aircraftEntity['manufactureDate'] = corticonDataManager.getOperator().dateTime.constructDateTime('2021-11-11T19:42:08+0000');
//The above code will create a datetime object and set the 'manufactureDate'	
To use other operators on a DateTime, you can access the operators available using corticonDataManager.getOperator().dateTime For example, to use the addDays operator:
aircraftEntity['manufactureDate'] = corticonDataManager.getOperator().dateTime.addDays('2021-11-11T19:42:08+0000', 4);
//The first argument is a datetime dataType and the second argument is a number.
//The function will add 4 days to the dateTime object and return the dateTime object.	
This example wants to add 20 days to a dateTime:
aircraftEntity['manufactureDate'] = corticonDataManager.getOperator().dateTime.addDays(aircraftEntity['inspectionDate'], 20);
//The first argument is a datetime dataType and the second argument is a number.
//The function will add 20 days to the inspectionDate and set the manufactureDate value to inspectionDate + 20 days.
To use the dateTime lessThan operator:
corticonDataManager.getOperator().dateTime.lessThan(aircraftEntity['inspectionDate'], aircraftEntity['manufactureDate']);
//Will compare the if the first parameter is less than the second and return a boolean. 
//Returns true if the first parameter is lessThan second, else false.	
To use the dateTime getMilliseconds operator:
corticonDataManager.getOperator().dateTime.getMilliseconds(aircraftEntity['inspectionDate']);
//Will return the current date and time as milliseconds since epoch (Jan 1, 1970) 	
Note: To see all the dateTime helper functions, link to Customized data access operators .

ASSOCIATIONS

See also Use APIs to update entities and associations.