Skip to main content
Jun 29, 2021 7:06 AM UTC
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!!

Jul 1, 2021 1:21 PM UTC

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

Jun 29, 2021 8:13 PM UTC

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.

Jun 30, 2021 2:56 AM UTC

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?

Jun 30, 2021 5:47 AM UTC

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).

Jun 30, 2021 12:06 PM UTC

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'