Skip to main content
17-Peridot
June 29, 2021
Solved

Update DT using service

  • June 29, 2021
  • 2 replies
  • 5097 views

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!!

Best answer by AP_9587236

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

2 replies

22-Sapphire I
June 29, 2021

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.

5-Regular Member
June 30, 2021

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?

17-Peridot
June 30, 2021

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

22-Sapphire I
June 30, 2021

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'