LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete rows of the table with help of a button in front panel?

Hi. I have created a vi such that when a button is pressed data is added to a row. How to delete a unwanted row of the table with help of a button in front panel?

0 Kudos
Message 1 of 4
(5,073 Views)

Hi,

 

the solution is quite simple.

You can remove the selected row by using property nodes. Using these, you have access to the data itself as you have by the local variables you already use, but you also can access other information about the control.

 

As you use a table, the hard part is to find which row has to be deleted. In my example below, i track which row the user selectes and delete this row if the user hits the "Delete" button.

To find the correct row, I use the invoke node which transforms the click position (in pixels) to a row/column information.

 

I hope that helps...

 

Kind regards

Felix

 

 

Felix Aeschimann | LabVIEW CLA
0 Kudos
Message 2 of 4
(5,063 Views)

(You probably need more than a button on the front panel, you also need to define the row to be deleted)

 

There is no need for expensive value property nodes. A table is nothing more than a 2D array of strings that you should keep in a shift register, then update the table indicator whenever the data in the array changes.

This reduces the problem to simple array operations on the 2D array. You know how to insert rows, so deleting a row is virtually the same.

 

Another option would be to use a multicolum liistbox instead of a table. Now you can very easily select a row and e.g. delete it using a double-click event, for example.

 

Also note that you have an immense amount of unecessary duplicate code to parse the string. How does the string look like? A direct translation of the current code would be to use a FOR loop and autoindex on an array of offsets. (It actually seems even more regular than that!).

0 Kudos
Message 3 of 4
(5,048 Views)

Here's a quick draft of what I had in mind (inserts new row on top and deletes topmost row, respectively). Maybe it can give you some ideas.

 

Keep it simple!

 

 

0 Kudos
Message 4 of 4
(5,031 Views)