LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a quick way to clear, delete data from a Table?

I would like to click on a button "Clear Data" and go and delete entire data from a table...
Thanks in advance-
0 Kudos
Message 1 of 5
(3,209 Views)
Here's one way.

int CVICALLBACK ClearTable (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int RowCount;
switch (event)
{
case EVENT_COMMIT:
GetNumTableRows (panelHandle, PANEL_TABLE, &RowCount);
if (RowCount > 0) {
DeleteTableColumns (panelHandle, PANEL_TABLE, 1, -1);
DeleteTableRows (panelHandle, PANEL_TABLE, 1, -1);
}
break;
}
return 0;
}
Message 2 of 5
(3,209 Views)
This actually deletes the rows and columns, not just the data. You'll need to InsertTableColumns() and InsertTableRows() to rebuild the table.
0 Kudos
Message 3 of 5
(3,209 Views)
The best way to do this is by calling FillTableCellRange. Just be sure you create different ranges whenever the cell type in your table changes. If all cells are of the same type, then you only need to do this once.
0 Kudos
Message 4 of 5
(3,209 Views)
DeleteTableRows() is all I needed.
Thanks-
0 Kudos
Message 5 of 5
(3,209 Views)