LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use combo box items from cluster, to connect into Case selector of Case Structure?

Solved!
Go to solution

My project is a vending coffee machine, and I have my project separated with clusters:

 

Main project viewMain project view

 

On the top left, I have this cluster where I can select which coffee I want to make:

cluster.png

 

Now, on the Block Diagram View, I have that same cluster and I want to connect it with the Case Selector, of the Case Structure. So instead of having "True or False", I can have the different coffees I may select.

case.png

 

 

I'm able to do that, If I put the combo box outsite the cluster, right?

But can I do that, by leaving the combo box inside the cluster?

 

I hope you understand the problem, and help me solve it as soon as possible.

0 Kudos
Message 1 of 9
(2,853 Views)
Solution
Accepted by topic author joaolourenco

Use Unbundle by Name to get the selected coffee out of the cluster.

0 Kudos
Message 2 of 9
(2,826 Views)

I appreciate your help! When I use Unbundle by Name, I'm able to get a lot of information from the cluster, but to get the combo box, shouldn't it be enough to wire the "Select the drink?"

 

something.png

 

 

I don't understand why, but with this example, when I select any other option from the combo box, it only shows the false.

Also, when I wire the Select Drink into the case selector of the case structure, the case stayed with true or false, only.

 

Can you help me to put this working, please? Maybe with a quick and similar example, from yours?

0 Kudos
Message 3 of 9
(2,806 Views)

If you want the control to be read when the while loop is running, it belongs inside the while loop. currently it gets read once when the VI start and the never again. Basic principles of dataflow.

 

Also your loop needs a wait. No need to spin millions of time per second.

0 Kudos
Message 4 of 9
(2,795 Views)

By control, you mean the cluster, correct?

 

I tried that, but it keeps not working... The case structure remains with True or False, and when I try to select another drink from the combo box, it only shows the false case.

Even when the program is not running, if I select another drink from the combo and then run.. it keeps on False.

 

I don't understand, but I'm not being able to show a selected item from a combo box with the cluster.. so I'll just remove the combo box from the cluster and use a Ring, outside the cluster.. with the options. That way I'm able to select and to show each each drink on the case structure.

 

Meanwhile, if you're able to help me with the cluster.. that would be awesome. Thanks anyway.

0 Kudos
Message 5 of 9
(2,747 Views)

Attach your current version so we can see what you did. You can easily problem the wire going to the case structure. Is it possible that the spelling is different (upper/lower case, number of spaces, etc.). So far we don't even know how the other cases are configured!

 

"False" is the default case so any drink that does not have a case will trigger it.

 

In any case, consider replacing your combobox with an enum.

0 Kudos
Message 6 of 9
(2,743 Views)

Thanks, I leave my file here.

 

I also send this image, so you can understand.. I know you'll found a lot of clusters and items.. but at this moment I only need to solve that problem, of selecting the drink and show it on the String Indicator.

 

As you can see in the image, I let both on the file, the one in the left is the Ring, outside the cluster who is working.. 

At the right, it is the combo box, inside the cluster.. who doesn't work.

 

printt.png

 

I hope that helps.. looking foward to understand what the problem might be.

I do appreciate your help! 

 

0 Kudos
Message 7 of 9
(2,728 Views)

I'm so sorry.. and I have an update!

I tried to insert the Ring inside the cluster, and it worked!! 

 

It is required to have that cluster to my project, so I was looking for help.. but that way, I think I'll just keep using the Ring, instead of the Combo Box.

 

By the way, do you have any idea why this happened?

 

Here's how I did it:

ring.png

0 Kudos
Message 8 of 9
(2,723 Views)

@joaolourenco wrote:

By the way, do you have any idea why this happened?


 

Your other cases will match strings "True" and "3". There are no drinks with these names, right? Thus you always get the default case. Did you really do any of the basic tutorials?

0 Kudos
Message 9 of 9
(2,705 Views)