LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Options to ComboBox from Spreadsheet in Run-Time

Solved!
Go to solution

Hi, I'm just starting to learn about LabView and I'm trying to make an interphase that can be dynamic with the user. In this case, I have a cluster in which the user will be able to add a new Profile (Name and other caractheristics). This information needs to be saved in an excel spreadsheet to be read later on. The first string of the cluster (name) needs to be added to the combobox list. In the first picture is the interphase where the data is added. In the second picture is the program i made for the information added in the cluster to be saved in a spreadsheet. In the last one I tried making a loop for the strings in the combobox to be updated with the new profiles that are being added. I'm having trouble with an error and I'm not sure what it is. 

 

Download All
0 Kudos
Message 1 of 8
(3,801 Views)

Suppose I asked you for help for a 1000-line C++ Program, and I sent you a screen-shot of 50 lines where the error was being thrown.  You'd say "Send me the code so that I can run it and see, for myself, how it runs, can add my own "error-checking" and use my own debugging tools, without having to try to type all 1000 lines in myself".

 

ATTACH YOUR VI!  Let us examine all of it (including let us try to "shrink it down to a reasonable size").  No Pictures, Please!!

 

Bob Schor

0 Kudos
Message 2 of 8
(3,767 Views)

You have datatype collisions. "Strings and values" is an array of clusters with two string elements each.

You have a string and convert it to an array of strings with one element and try to append that to the array of clusters. Won't work!

First you need to form a cluster of two strings (String and value in the correct cluster order), then append it to the "string and values array" and write it back. To append a scalar element to the end a 1D array, use "built array". (No need to get the size or use "insert into array")

 

 

SnV.png

 

(Also, your use of the event structure does not seem correct).

 

As has been said, we probably could give much more specific advice if you would attach your VI)

0 Kudos
Message 3 of 8
(3,750 Views)

Thank you so much, and I'm sorry, It's my first time asking for help in a forum. I'll attach the VI, but also I'm going to try the configuration you just showed me. As I'm just starting to learn, I very much appreciate all the feedback.  Again, thank you! 

 

Lily Castillo

0 Kudos
Message 4 of 8
(3,739 Views)
Solution
Accepted by topic author lcastillo32

I think I gave you the solution to your problem, but here are some comments to your code:

 

  • You don't seem to have a toplevel while loop. Are you using the "continuous run button? Don't.
  • Once the code runs the "Especificaciones Prueba... "Perfil Predetrminado" case, the VI can no longer be stopped, just aborted. It will continue to append the same entries to the combo box until you run out of memory.
  • The case structure with a TRUE diagram constant wired can be deleted.
  • The three-frame flat sequence structure can be deleted, execution order is fully determined by dataflow.
  • If somebody would press the "Iniciar prueba" button if the code is not executing the "Resultados" frame, the VI will lock up forever, because the event cannot complete, but will lock the front panel until the event completed.
  • Same with the "Ingresar Perfil" button
  • ...

My suggestion is to rewrite the code as a simple state machine with one outer while loop and none of the inner while loops. Correctly place one single event structure so it can execute whenever needed. Add event cases for all user actions.

Message 5 of 8
(3,732 Views)

@lcastillo32 wrote:

Thank you so much, and I'm sorry, It's my first time asking for help in a forum.


Welcome to the forums.  There is an Unofficial Forum Guidelines here which tries to cover some of the things that help get you the best help when you have questions.

0 Kudos
Message 6 of 8
(3,687 Views)

This VI will eventually be an executable in which the user will be able to add a new option to the combobox via "Ingresar Nombre Nuevo Perfil" whatever is introduced here and after clicking OK the new name needs to appear as an option in the Combobox. I'm very confused about it, and I'm not sure if I'm doing it the right way. I'd really appreciate the help. 

 

At first I save all the information of the cluster "Ingresar Nuevas específicaciones" into a spreadsheet. I also tried reading the information from it, but i haven't been able to transfer the first row of information into the Combobox. I will appreciate all the feedback as I'm just starting to learn how to use LabView. Thanks!

 

PD. The "resultados" case is still not finished.

0 Kudos
Message 7 of 8
(3,692 Views)

Still looks completely dysfunctional. If you are reading the file as strings, a %f format is not right and an empty string as delimiter is also not right. You need to read the file when the program starts to fill the existing entries, then append any new entries generated in the current session.

 

All my other advice still applies (deeply buried event structures, etc.). Why are you using a combobox? A "ring" might be more useful here (not shown)

 

Here is a very quick draft, see if it can give you some ideas.

0 Kudos
Message 8 of 8
(3,645 Views)