LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inserting columns from table into an 2D array

Solved!
Go to solution

Hello, I'm actually new user for Labview. 

I've a issue with replacing values from a table into an array of comboboxes.

The Idea is: 

I want to create a UI. by clicking the table a new PopUp window should open.

This Windows should contain an Array out of Comboboxes. The First row should show me the column header (this works).

In the second row i want to collect each column information from the table into each Comboboxes .

 

actually I can insert the Information into a seperate combobox. but if i want to replace information from the array i do not work.

 

I am very thnakful 

 

0 Kudos
Message 1 of 13
(657 Views)

Hi KKoch,

 

what have you tried and where did you fail?

Mind to attach your VI with some example data?

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 2 of 13
(636 Views)

Replacing columns is a different operation from inserting columns in an array.

 

Replacing columns implies you will need Replace Array Subset, and also shift registers to store the contents of the array between iterations of your master while loop.

0 Kudos
Message 3 of 13
(630 Views)

The thing is that all elements in an array have the same type, and property values.

 

So if your first column has the headers as an item, the 2nd array must have the same items as the headers.

 

What you want is a grid control. Sadly, that's not too easy in LabVIEW.

 

Should the user be able to select the headers?

 

In stead of a 2D array of comboboxes, you can fake a UI that looks the same. I'd use a MultiColomnListBox. The items are all strings. When the user clicks a cell (mouse down event), replace the button with a 2 (right click). This triggers a Menu Activation event. Set the specific cell's items. If the user selects an item, it triggers a menu selection event. Change the cell's value...

 

If the 2nd column is an array of comboboxes with the same items, you can also make the headers a 1D array, and the values a 2nd array. Then make a manual scrollbar, and move the top left element of both arrays when it gets a value change event.

0 Kudos
Message 4 of 13
(626 Views)

I've failed by inserting values from the Combobox into the selected Combobox (Index Row:1 Column 0) in the Array.

Now all comboboxes have the same values.

 

attached is the test VI - Actually everthing happens in one Screen

0 Kudos
Message 5 of 13
(610 Views)

I've put a transparent box infront of the first row. So the User is blocked to change the values there.

 

Each Column in the array should have different Informations 

0 Kudos
Message 6 of 13
(606 Views)

@KKOCH wrote:

I've failed by inserting values from the Combobox into the selected Combobox (Index Row:1 Column 0) in the Array.

Now all comboboxes have the same values.

 

attached is the test VI - Actually everthing happens in one Screen


Your array is 1Xn... There's no 1,1 element. It should be 0, 1. 0 is the first row, and there is only 1 row. So no row 1...

0 Kudos
Message 7 of 13
(598 Views)

@KKOCH wrote:

I've put a transparent box infront of the first row. So the User is blocked to change the values there.

No, you've put a transparent box behind the first row. So the user is not blocked...

 

As long as you're happy with that, there's no problem. It usually gets annoying quite fast. Every change of position or ordering, you have to think about moving all transparent things. At some point someone (future you) will forget.

0 Kudos
Message 8 of 13
(597 Views)

Is it possible to fill each combobox in the array with the values of the seperate combobox?

Maybe this VI is better to show my idea

0 Kudos
Message 9 of 13
(585 Views)

@KKOCH wrote:

Is it possible to fill each combobox in the array with the values of the seperate combobox?

Maybe this VI is better to show my idea


If you want to do fancy UI things, you should investigate time in learning how to use the event structure.

 

If you want don't want fancy UI things, you should also investigate time in learning how to use the event structure 😊.

 

It seems you're shewing more then you can swallow. Not only because you don't know all the tricks you need to know, but also because you're doing things in a very difficult way.

Message 10 of 13
(575 Views)