LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filling data to specific column in table control from array

Solved!
Go to solution

I'm currently trying to autofill string data from an Array into a table control in a certain column but I can't find a way to do it properly.

 

Can someone show me how to pull and insert data into specific columns/cells within a table control?

 

For example, I'm trying to put these string values into the second column of the control table but it's not working.

 

0 Kudos
Message 1 of 19
(8,649 Views)

Hi Lu,

 

your VI is full of wrong array handling (and overuse of locals and sequence frames)…

Did you take the free beginner courses to learn LabVIEW?

 

Can someone show me how to pull and insert data into specific columns/cells within a table control?

 A table just displays a 2D array of strings, so you need to put the string into the corresponding elements of your array!

 

For example, I'm trying to put these string values into the second column of the control table but it's not working.

Create an array with 2 columns and replace the elements in this array!

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 19
(8,625 Views)

Indeed, I have not taken the free course yet. I am currently self learning at this point. Is the application for the course on here? 

 

I do have a second question. Is it possible to  append another control table to an existing control table by the last used column in the original table control?

0 Kudos
Message 3 of 19
(8,596 Views)

I imagine that you want to later replace other rows with data, so easiest would be to keep the 2D array in a shift register and replace the empty string with new data as needed. Where does the data come from? How often does new data arrive? How many different rows do you expect to have at the end?

 

  • Yes, you definitely need to do the tutorial before going any further. Sequence structures and local variables are not needed for any of this.
  • Even setting the indices of an empty 2D array diagram constant to 1000 still makes in an empty array.
  • There is no logic to most of your code.
0 Kudos
Message 4 of 19
(8,590 Views)

TeddyLu wrote: 

I do have a second question. Is it possible to  append another control table to an existing control table by the last used column in the original table control?


I don't understand what that means.Tables are typically indicators, why do you call it a control? It seem you want to display several datasets in the same table. Yes, anything is easily possible.

0 Kudos
Message 5 of 19
(8,588 Views)

@altenbach wrote:

TeddyLu wrote: 

I do have a second question. Is it possible to  append another control table to an existing control table by the last used column in the original table control?


I don't understand what that means.Tables are typically indicators, why do you call it a control? It seem you want to display several datasets in the same table. Yes, anything is easily possible.


Yes, tables are typically indicators, but in this instance I'm adding more data into a single table as you have stated, therefore, using them as table controls with manual input values. I was able to add the tables together using "insert into array" without providing constants for the indexes. The additional data was added to the last row used of the original table instead of the last column used, which is my intended target

0 Kudos
Message 6 of 19
(8,585 Views)

@TeddyLu wrote:

The additional data was added to the last row used of the original table instead of the last column used, which is my intended target

If the table is a control, you can edit any value you want directly into the table. Since these are string, you might want to add some validation if the entry should be numeric.

 

Keep the table data in a shift register. Just use an event structure and watch for "table:value changed", the validate and either update by keeping the new value or ignore the added entry by writing the old value via a local variable.

0 Kudos
Message 7 of 19
(8,566 Views)

OK, here's a very rough example that show how you can mix programmatic and manual table entries.

 

Press any of the add buttons to fill the corresponding row with four random numbers, leaving the fifth column untouched. At any time, you can manually enter text to the fifth column. (if you try to edit in the first four column, it will be rejected).

 

See if this makes sense...

Message 8 of 19
(8,558 Views)

I do apologize, I guess I wasn't really clear on what I was trying to do. 

Here is a mock example attached of what I'm trying to describe.

As you can see, with the help of the earlier posts, I was able to get the cluster boolean control values to be inputted into a specific column.

However, I do have an additional table control with the manual inputs that I need to add to the programmatic table that was created earlier.

The information is being added was appended to the bottom last used row in the programmatic table instead of the last used column

 

In other words, I'm trying to copy and paste what I have from the manual input table next to the values in the programmatic table

0 Kudos
Message 9 of 19
(8,551 Views)

(posting by phone, cannot see your code)

 

The principle remains the same: keep a sufficiently sized 2D array of strings in a shift  register and replace parts with new data using "replace array subset" as needed before updating the table again. ("Insert into array" is most often the wrong tool.)

0 Kudos
Message 10 of 19
(8,547 Views)