cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Update datatable Failure

skumar-81
4-Participant

Update datatable Failure

This may be a basic question. But why does this fail ?, What is the right way to update ?

var values = Things["TestDataTable"].CreateValues();
values.Id = Id; //INTEGER [Primary Key]
values.Name = "Name"+Id; //STRING

var params = {
	maxItems: undefined /* NUMBER */,
	values: values /* INFOTABLE*/,
	query: undefined /* QUERY */,
	source: undefined /* STRING */,
	tags: undefined /* TAGS */
};
// result: INFOTABLE
var table = Things["TestDataTable"].QueryDataTableEntries(params);

if(table.length>1)
{
var row = table[0];
var values = Things["TestDataTable"].CreateValues();
values.Attendance = 11; //NUMBER
values.RollNum = row.RollNum; //STRING [Primary Key]
values.Percent = 11; //INTEGER
values.Id = row.Id; //INTEGER [Primary Key]
values.Name = row.Name; //STRING

var params = {
	sourceType: undefined /* STRING */,
	values: values /* INFOTABLE*/,
	location: undefined /* LOCATION */,
	source: undefined /* STRING */,
	tags: undefined /* TAGS */
};
// no return
Things["TestDataTable"].UpdateDataTableEntries(params);
}

 

1 REPLY 1
supandey
19-Tanzanite
(To:skumar-81)

Hi @skumar-81 could you share what the exact error is?

Top Tags