Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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.
Solved! Go to Solution.
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)
My C days are long gone, but you haven't checked it_row for null, are you sure it's not null?
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.
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)