.dataset().row().update()

.dataset(...).row(...).update(data: object): Promise<IData>

Update the data for a given row with a complete or partial update.

Parameters

  • data object
    The data that should be written to the row for its new values. This will be an object that contains properties who's names start dp- for data points and l- for links. To get the data point id's please use the .dataset().schema() method or refer to the "ID" for the data point which can be found in the Data set inspector of the Data tab for the data set. The number of dp-{number} parameters will depend upon the number of data points configured for the data set. Each is optional (unless a "Required" validator is set for the data point) and will take the default value if not specified.

Returns

This method returns a Promise which will resolve to an object containing a data object with the data for the updated row, if there are no errors, in the same structure as .dataset().data() method. Additionally, if any errors are reported there may be error and fieldError properties. If there are no errors, the error properties will not be present.

{
    "data": {
        "id": number,
        "dv": number,
        // ... data values
    },
    "error": string,         // General error information
    "fieldErrors": [
        {
            "name": string,  // Name of the data point in error
            "status": string // Error message
        }
    ]
}

Example

Consider the following being sent to our example data set for flights, updating the row that was inserted in the .dataset().insert() example:

const api = new CloudTablesApi('sub-domain', ':apiKey');

let result = await api.dataset(':id').row(13).update({
	'dp-11': 'Supersonic'
});

Will result in the following JSON being stored in result:

{
	"data": {
		"id": 27,
		"dv": 0,
		"dp-11": "Supersonic",
		"l-5": [{
			"id": 11,
			"dp-8": "Aberdeen"
		}],
		"l-6": [{
			"id": 3,
			"dp-8": "Bristol"
		}]
	}
}