LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with Deleting Table Headers

Solved!
Go to solution

Hi NI community,

I need your help with deleting the row headers of a table.

The first time the program runs everything is OK.

However, when the user sets a new number of tests and clicks the ‘Run Again’ button the old row headers not only are not being deleted but the new ones are appended under them.

I would like the entire table, headers including, to be deleted and the new results to be displayed starting from the top of the table.

I am attaching a sample program.

Thank you in advance for your help.

0 Kudos
Message 1 of 11
(3,850 Views)

Here are some ideas (let me preface this by saying I've not worked much with Tables).

 

1.  The Set Cell Value method you are using has been removed in LabVIEW 2012 (and successors), so you may want to consider an alternative.

2.  Writing the string "erase" into a cell does not erase the cell, it just makes the cell display "erase".

3.  However, writing an empty array into RowHdrs[] may well clear out the row headers.

4.  Similarly, wiring an empty 2D array into the Table may well clear out the Table.

5.  I'm not 100% certain, but I believe that the Row Headers usually are in Column 1, and the Column Headers are in Row 1 -- be sure not to mix them up.

 

Note that you should be able to safely do steps 3 and 4 just before you try to "fill" the Table.  If you do, then the exact same code should work whether you are filling the table for the first time (when it is already empty) or the 20th time (when there is something to erase).

 

Bob Schor

0 Kudos
Message 2 of 11
(3,841 Views)

Hi Bob,

I did not know about the Set Cell Value removal. Thanks for the information.

I replaced it with an empty array but it still does not work.

What troubles me the most is the new headers being appended under the existing ones instead of starting from the beginning. (There is no such problem with the table values, only with the row headers)

Wiring 'erase' was simply for display purposes Smiley Embarassed

0 Kudos
Message 3 of 11
(3,834 Views)
Solution
Accepted by topic author Broni

You need to initialize your first shift register )inside the first sequence frame).

 

Even better, simply use autoindexing to create the array, no shift register needed.

 

 

Also note that writing the header does not belong in a loop, writing them once is sufficient. Use the proper datatypes. For example the number of trials is an integer. You have way too many unecessary local variables and sequence structures. most are not needed.

Message 4 of 11
(3,819 Views)

You have uninitialized shift registers where you're building your row header arrays.  This code exists in two places.  Why?  Regardless, if you initialize your shift registers, Bob will be your uncle.

 

TableHeader_BD.png

 

 

Spoiler
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 5 of 11
(3,816 Views)

It worked! It worked!

It does exactly what I need.

Thank you very much.

You are the best!!! 

0 Kudos
Message 6 of 11
(3,812 Views)

@Broni wrote:

It worked! It worked!

It does exactly what I need.

Thank you very much.

You are the best!!! 


I added more information to my answer. Please clean up your code, there is way too much stuff that is incorrect or not needed. For example remove the loops around the header property nodes. Writing once is enough! What good is writing the same property with the same values N times in a row?

0 Kudos
Message 7 of 11
(3,798 Views)

Thank you for all your recommendations.

I followed them and now the code not only looks much better ... but it works as well.

Thank you! 

0 Kudos
Message 8 of 11
(3,783 Views)

If the number of trials is not always an integer multiple of 20, you would make a small modification as follows.

 

 

0 Kudos
Message 9 of 11
(3,779 Views)

The trials must be run in blocks of 20.

If the user’s input is for example 75, then this number is rounded to the closest multiple of 20 that does not exceed the user’s input (60 in this case).

Just out of curiosity, what is the function of the node connected to the remainder? I do not seem to be able to find it in LabView 9.

0 Kudos
Message 10 of 11
(3,765 Views)