LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a ENUM from EXCEL Colum

 I am building a generic test programme. The test programme is to test multiple part numbers (Sensors) Each of the part numbers and its variables that will drive the programme are stored in excel workbook. One colum will have part number the rest will be the variables that drive the labview programme. 

 

When the programme starts i want it to populate a ENUM on the front panel with all the part numbers from colum A on the excel work book. Then when the user selects which part number they want to test it returns the row number for this part number from the excel sheet. 

I can most likely figure out how to return the row number but does anyone know how i can populate the ENUM with the part numbers from colum A of the excel worksheet.

 

thanks 

0 Kudos
Message 1 of 6
(5,812 Views)

You can't edit enum list in runtime mode, only in edit mode,
Instead ENUM use RING control and "strings[]" property node

.ring.png

Message 2 of 6
(5,799 Views)

Here's a little utility I made a while ago.  The VI is set to run when opened so if you put it in the following folder it will show up in your tools menu.

 

<LabVIEW Install Folder>\project

 

Bascially just copy a bunch of cells from Excel into your clipboard, then click Paste and then OK and an enum will be made from your clipboard contents.  This relies on the OpenG array package.

 

As mentioned this is only for things that don't change at run-time, because enums can't change at run time, in these cases use a Ring.

Message 3 of 6
(5,746 Views)

There is a quick work-around to get your spreadsheet (or array) into an enum list.  You can write it to a Text Ring then replace the ring with an Enum!  Other means exist involving references to your vi control, but this seems to be the simplest if you only need to populate it once. 

 

After you create the Strings[] property node for the Text ring and run it once, do the replace (on the front panel select the control, Ctrl + space, "en", Ctrl + p).  I added some notes in the snippet about generating an array for use/notes in the process.Run this first.Run this first.Then replace on front panel.Then replace on front panel.

This give you the enum, which you can now move to your separate vi. 

 

 

Message 4 of 6
(4,955 Views)

Try this.

"If you weren't supposed to push it, it wouldn't be a button."
Message 5 of 6
(4,931 Views)

Paul beat me to it!  I have a Behavioral Trials routine driven by an Excel Workbook, which is fairly "static" in structure (i.e. the names of the columns stay the same), at least until the Experimenter wants to do "one more little thing" which involves adding a dozen new parameters to each trial (but that's another story).

 

I also wanted a static Enum based on the "Master Workbook" (the prototype from which each Experimenter designs her, or his, Experiment by specifying the various parameters for each Trial).  I actually also made a GigundaCluster that corresponded to all of the variables for a single Trial.  To create the Enum and the Cluster, I turned to LabVIEW Scripting, and did much as Paul described.  Worked very nicely.  Note, however, that this is done at Development time, not at Run Time.  For a Run Time Solution, you need to use a Ring or possibly a Combo Box, something that you can populate via Property Nodes at Run Time.

 

Bob Schor

0 Kudos
Message 6 of 6
(4,925 Views)