|
Parameter Name
|
Description
|
Base Type
|
|---|---|---|
|
tags
|
Data Tags for the entries (optional).
|
TAGS
|
|
location
|
Location of the entry (optional).
|
LOCATION
|
|
source
|
Source of the entry (optional).
|
STRING
|
|
sourceType
|
Source type (optional).
|
STRING
|
|
values
|
Values to be added or updated in the data table.
|
INFOTABLE
|
|
Parameter Name
|
Description
|
Base Type
|
|---|---|---|
|
Result
|
Returns a STRING value of the streamID of the new or updated entry in the data table
|
STRING
|
// tags:TAGS
let tags = new Array();
// values:INFOTABLE(Datashape: DTAuditShape)
let values = Things["AuditDataTable"].CreateValues();
values.auditCategory = undefined; // STRING
values.messageArgs = undefined; // INFOTABLE
values.id = undefined; // GUID [Primary Key]
values.message = undefined; // STRING
values.user = undefined; // STRING
// location:LOCATION
let location = {
latitude: 0,
longitude: 0,
elevation: 0,
units: "WGS84"
};
let params = {
tags: tags,
source: me.name,
values: values,
location: location
};
// AddOrUpdateDataTableEntry(tags:TAGS, source:STRING("me.name"), values:INFOTABLE(AuditDataTable), location:LOCATION):STRING
let id = Things["AuditDataTable"].AddOrUpdateDataTableEntry(params);
|
Parameter Name
|
Description
|
Base Type
|
|---|---|---|
|
tags
|
Data Tags for the entries (optional).
|
TAGS
|
|
location
|
Location of the entry (optional).
|
LOCATION
|
|
source
|
Source of the entry (optional).
|
STRING
|
|
sourceType
|
Source type (optional).
|
STRING
|
|
values
|
Values to be added or updated in the data table.
|
INFOTABLE
|
// Define the parameters for creating the InfoTable
var params = {
infoTableName : "InfoTable",
dataShapeName : "EmployeesDataShape"
};
// Create the InfoTable
var valuesInfotable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
// Define a updated entry to be added
var UpdatedValuesRow = {
EmployeeID: "209833",
Name: "Vishal",
Role: "Software Engineer Specialist",
Salary: "50000"
};
// Add the new row to the InfoTable
valuesInfotable.AddRow(UpdatedValuesRow);
// Define a new entry to be added
var addValuesRow = {
EmployeeID: "209838",
Name: "Sagar",
Role: "QA",
Salary: "40000"
};
// Add the new row to the InfoTable
valuesInfotable.AddRow(addValuesRow);
Things["EmployeesDataTable"].AddOrUpdateDataTableEntries({
sourceType: undefined /* STRING */,
values: valuesInfotable /* INFOTABLE */,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
});