Skip to main content
17-Peridot
Solved

Update DT using service

I have a datatable having fielddefinitions of datatype infotable(5 rows & 5 columns). I want to update those infotables fielddefinitions using script. I am trying to pass values in a query of UpdateDataTableEntriesWithQuery. But its not working!!

17-Peridot

I used this logic inside for loop, the custom datas are successfully updating inside Datatable. Thanks for your help.

 

updateValues = Things[DataTableName].GetDataTableEntries();

updateValues[i].Details[0].Name = Name1;
updateValues[i].Details[1].Name = Name2;
updateValues[i].Details[2].Name = Name3;
updateValues[i].Details[3].Name = Name4;
updateValues[i].Details[4].Name = Name5;
updateValues[i].Details[5].Name = Name6;// INFOTABLE

var params1 = {
tags : undefined,
source : undefined,
values : updateValues,
location : undefined
};

// UpdateDataTableEntries(tags:TAGS, source:STRING("me.name"), values:INFOTABLE(DTName), location:LOCATION):STRING
Things[DataTableName].UpdateDataTableEntries(params1);

16 replies

22-Sapphire I

What exactly are you trying to do?

UpdateDataTableEntriesWithQuery would update matching rows in your table. (runtime operation)

but you say you want to update infotable field definitions which is a design time operation.

Translate
5-Regular Member

Yes, the description is misleading.

 

Are you trying to update the DataShape of your Datatable, or update the value of this DT? 

The infotable you mentioned is for your whole DT value entry, or a specific column which is an infotable typed property?

Translate
17-Peridot

Exactly, The datatable having specific columns which is an infotable typed property? I want to update that column (having infotable datatype) through script(by getting datas from user).

Translate
22-Sapphire I

You should be able to create an insert or update with a payload that has infotables in it.

I would start with the AddDataTableEntry snippet from 'snippets'

Translate