Skip to main content
Version: 5.15.0

UpdateDataWithCalculation

public BackendReturnObject UpdateMyLatestDataWithCalculation(string tableName, Param param);
public BackendReturnObject UpdateMyDataWithCalculation(string tableName, string inDate, Param param);
public BackendReturnObject UpdateOtherDataWithCalculation(string tableName, string inDate, string owner_inDate, Param param);

Parameters

ValueTypeDescription
tableNamestringTable name to be updated
inDatestringinDate value of the row to be updated
owner_inDatestringinDate of the user who owns the row
paramParamInformation to be updated (inserts data using AddCalculation)

Description

UpdateMyLatestDataWithCalculation method modifies a piece of my data that has been registered most recently in the table via addition or subtraction.
UpdateMyDataWithCalculation method modifies a piece of my data in the table identical to inDate via addition or subtraction.
UpdateOtherDataWithCalculation method modifies a piece of my data in the table identical to inDate and owner_inDate via addition or subtraction. (If public, the data of others can also be modified.)

  • The data can be modified regardless of schema definition status.
  • You can only modify your own public/private data.
  • You can modify the public data of others.
  • You cannot modify the private data of others.

The number type data stored in the table are modified via addition or subtraction.
You can add or subtract the base value by the number you enter.

  • When using this method, the parameter's param must only use AddCalculation(). (Typing Add() will cause an error.)
  • Modification of game information can be performed for only one row.
  • You cannot modify the private table of others. (Available for public tables)
  • UpdateData() only requires the data to be modified; however, in the case of UpdateWithCalculation(), you may experience a heavier usage of DB compared to Update because the process checks and modifies the numbers of the data.

Reserved column

When saving, eight fields, including partition, gamer_id, inDate, updatedAt, sender, receiver, reservationDate, owner_inDate, client_date, are used by the server.
When these columns are included in the param, an error occurs.

ValueDescriptionWhether the value is displayed in BACKND Console
partitionValue used by the server to classify a tableX
gamer_idGamer ID of the row ownerO
inDateinDate of the row (key value)O
updatedAtTime the table was last modifiedO
senderValue used internally for BACKND function (e.g., mail)X
receiverValue used internally for BACKND function (e.g., mail)X
reservationDateValue used internally for BACKND function (e.g., mail)X
owner_inDateUser inDate of the row ownerO
client_dateThe time when the client first requested data creationO

In the case of old version tables' rows without the owner_inDate, an owner_inDate column is added when the rows are updated by using the corresponding method.

Example

Synchronous

Param param = new Param();
param.Add("gold", 100);
param.Add("level", 2);

// Modify my data that has been registered most recently in the table
Backend.PlayerData.UpdateMyLatestData("tableName", param);

// Modify my data in the table that is identical to inDate
Backend.PlayerData.UpdateMyData("tableName", "2023-10-25:11:34:24.124Z", param);

// Modify data in the table identical to inDate and owner_inDate (data of others can also be modified)

Backend.PlayerData.UpdateOtherData("tableName", "2023-10-25:11:34:24.124Z", "2023-10-22:09:14:35.616Z", param);

Asynchronous

Param param = new Param();
param.Add("gold", 100);
param.Add("level", 2);

// Modify my data that has been registered most recently in the table
Backend.PlayerData.UpdateMyLatestData("tableName", param, (callback) =>
{
// Post-process
});

// Modify data in the table that is identical to inDate
Backend.PlayerData.UpdateMyData("tableName", "2023-10-25:11:34:24.124Z", param, (callback) =>
{
// Post-process
});

// Modify data in the table identical to inDate and owner_inDate (data of others can also be modified)
Backend.PlayerData.UpdateOtherData("tableName", "2023-10-25:11:34:24.124Z", "2023-10-22:09:14:35.616Z", param, (callback) =>
{
// Post-process
});

SendQueue

Param param = new Param();
param.Add("gold", 100);
param.Add("level", 2);

// Modify my data that has been registered most recently in the table
SendQueue.Enqueue(Backend.PlayerData.UpdateMyLatestData, "tableName", param, (callback) =>
{
// Post-process
});

// Modify data in the table that is identical to inDate
SendQueue.Enqueue(Backend.PlayerData.UpdateMyData, "tableName", "2023-10-25:11:34:24.124Z", param, (callback) =>
{
// Post-process
});

// Modify data in the table identical to inDate and owner_inDate (data of others can also be modified)
SendQueue.Enqueue(BackendBackend.PlayerData.UpdateOtherData, "tableName", "2023-10-25:11:34:24.124Z", "2023-10-22:09:14:35.616Z", param, (callback) =>
{
// Post-process
});

ReturnCase

Success cases

When the modification is successful
statusCode : 200 message : Success returnValue : {"ConsumedCapacity":{"Read":{"CapacityUnits":1},"Write":{"CapacityUnits":4}}}

Error cases

When GameInfoOperator.multiplication (multiplication) and GameInfoOperator.division (division) have been passed into Param.AddCalculation()
statusCode : 400
errorCode : ValidationException
message : Can't use multiplication and division in param.AddCalculation(GameOperator)

(Schema) When the data type of the column declared upon defining the schema is different from the data type to undergo InsertData
statusCode : 400
errorCode : BadParameterException
message : bad {column name} dataType, Invalid {column name} dataType

(Schema) When InsertData is attempt on a column whose schema is not defined
statusCode : 400
errorCode : BadParameterException
message : bad column does not exist., The invalid column does not exist.

(Schema) When the size of the list set upon declaring the list column in the schema is larger than the size of the list entered in param
statusCode : 400
errorCode : BadParameterException
message : bad list data length, Invalid list data length

(Schema) When the size of the map selected upon declaring the map column in the schema is different from the size of the map entered in param
statusCode : 400
errorCode : BadParameterException
message : bad map data length, Invalid map data length

When the total number of columns to be registered exceeds 290
statusCode : 400
errorCode : ValidationException
message : Invalid UpdateExpression: Expression size has exceeded the maximum allowed size;

When the size of the data being registered exceeds 400 KB
statusCode : 400 errorCode : ValidationException message : Item size has exceeded the maximum allowed size

When the size of the data being registered exceeds 400 KB
statusCode : 400 errorCode : ValidationException message : Item size to update has exceeded the maximum allowed size

When an attempt is made to perform InsertData on a non-existent table
statusCode : 404
errorCode : NotFoundException
message : table not found, table cannot be found

When the eight fields (partition, gamer_id, inDate, updatedAt, sender, receiver, reservationDate, and owner_inDate) are included in param
statusCode : 405
errorCode : MethodNotAllowedParameterException
message : MethodNotAllowed {param value}, Unavailable {param value}

When there is an attempt to register to a deactivated tableName
statusCode : 412
errorCode : PreconditionFailed
message : inactiveTable prerequisites are not met.

When the size of the data being registered exceeds 400 KB
statusCode : 413
errorCode : ServerErrorException
message : request entity too large