Question
Update a value in an infotable
Good day all,
I have a table that contains a timestamp field.
I want to replace the values in this field with a specific dataDifference calculation that I make.
The two dates that I use to find the difference are inputs.
I have written the code below. It seems like the issue occurs when I assign the new timestamp value to the table.
if (testMode) {
// Get data directly from the property for testing purposes
searchTable = Things["ThingName"].ChartData[0].Data;
} else {
searchTable = data;
}
let params = {
t1: searchTable /* INFOTABLE */
};
let clonedTable = Resources["InfoTableFunctions"].Clone(params);
// Find the row in searchTable with the matching timestamp
let searchForTimestampRow = clonedTable.Find({timestamp: currentTimestamp});
if (searchForTimestampRow) {
// Calculate duration
let duration = dateDifference(currentTimestamp, otherTime);
// Update the duration field; assuming you want to add a 'duration' field
searchForTimestampRow.timestamp = duration;
}
// Update searchTable with the modified cloned data
searchTable = clonedTable;
result = searchTable;
Has anyone tried doing this before?
Your response is much appreciated.

