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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Remove row from C SDK edge infotable

AliBenBelgacem
14-Alexandrite

Remove row from C SDK edge infotable

Hello,

 

Is there a method to delete a row from infotable 'twInfoTable' on C SDK.

I am able to add row twInfoTable_AddRow, also update specific entry in row using 'twList_ReplaceValue'

But couldn't delete a row.

I tried this example after add 3 rows in my example datatable  (the second row exist

twInfoTable* it = TW_GET_PROPERTY(DEFAULT_THING_NAME, "Inventory").infotable;
twInfoTableRow* it_row = twInfoTable_GetEntry(it, 1);
twInfoTableRow_Delete(it_row);
TW_SET_PROPERTY(DEFAULT_THING_NAME, "Inventory", twPrimitive_CreateFromInfoTable(it));

 I have a classic c error :Segmentation fault (core dumped) at the last line of code.

Thank you for your help.

ACCEPTED SOLUTION

Accepted Solutions
AliBenBelgacem
14-Alexandrite
(To:Rocko)

I find out the solution and it's very simple

we can use twList_Remove(..) to remove a row from an infotable

After all infotable its a list of rows so we can use directly twList_Remove(infotable->rows, rowToDelete, TRUE)

 

View solution in original post

4 REPLIES 4

My C days are long gone, but you haven't checked it_row for null, are you sure it's not null?

AliBenBelgacem
14-Alexandrite
(To:Rocko)

Already checked 

I am by no way an expert on this, but I recommend creating a ticket with Support. To me it looks like twInfoTableRow_Delete just frees the memory but does not remove the row from the infotable. The workaround would be to copy over the rows you want to keep to a new infotable.

AliBenBelgacem
14-Alexandrite
(To:Rocko)

I find out the solution and it's very simple

we can use twList_Remove(..) to remove a row from an infotable

After all infotable its a list of rows so we can use directly twList_Remove(infotable->rows, rowToDelete, TRUE)

 

Announcements


Top Tags