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

How to insert value to column in Data table

Nuttapol
11-Garnet

How to insert value to column in Data table

I want to create data table but i can't insert to next column how i can do

11111.png

6 REPLIES 6

you want to insert data in next "ROW" or add new "COLUMN"?

for new "ROW" - use AddDataTablEntries service.

for new Column - Edit its DataShape and add the required one.

I want to add new COLUMN

dupatel
19-Tanzanite
(To:Nuttapol)

Nuttapol Pomtong​ : To add column to your DataTable (DT) you will have to update your DataShape(DS). You can edit the associated DS used by DT and add required field using Field Definitions in DS.

-Durgesh

PaiChung
22-Sapphire I
(To:Nuttapol)

Are you saying you are creating an InfoTable and you want to add a column to that InfoTable?

If so use AddField

If you are actually working with a DataTable, you can only insert what is defined in its datashape.

use Add or AddOrUpdate DataTableEntry (ies)

Do you have any example code for Add or AddOrUpdate DataTableEntry (ies)?

supandey
19-Tanzanite
(To:Nuttapol)

Nuttapol, are you looking for something like this

Here SpeedDTDemo is my dataTable on which i am doing single entry insert using the AddDataTableEntry service

var values = Things["SpeedDTDemo"].CreateValues();

values.SpeedVal = inputVal; //NUMBER [Primary Key]

var params = {

sourceType: undefined /* STRING */,

values: values /* INFOTABLE*/,

location: undefined /* LOCATION */,

source: undefined /* STRING */,

tags: undefined /* TAGS */

};

// result: STRING

var id = Things["SpeedDTDemo"].AddDataTableEntry(params);

If you are simply testing the service you will not see all the data that has been inserted previous to that particular call, for that you either need to navigate to your Datatable > HomeMashup, like i have shown below in the screenshot, or else you have to query your datatable to see the values that has been inserted so far

Hope this helps.

Announcements


Top Tags