LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Autofill text ring items from spreadsheet

Solved!
Go to solution

I want to be able to read the items from a tab delimited file and if the selection on the first text ring is found in the spreadsheet, the second text ring will be filled with the items shown in the second column. I managed to do this, but I'm having a bit of a problem, because the items change, but are not added to the list. What I mean is that only 2 items are displayed and the rest are not added. I also wish that if no items are found, the list would stop populating over again.

Can someone please take a look at my VI, and help me fix this problem?

Thanks.

Download All
0 Kudos
Message 1 of 9
(4,431 Views)
Solution
Accepted by topic author Nando88

Try to avoid coding in timeout case.  I have disabled the code in timeout case, and when the 1st ring value changes, I am using a "for" loop to find all possible matches, and insert those in the 2nd ring.

------
Using LabVIEW since 2012. Certified LabVIEW & TestStand Architect
Message 2 of 9
(4,406 Views)

That's exactly what I was looking for.

Is it possible to retrieve the prices for a certain item?

What I was thinking was to enter a new column in the database, with the prices, so that when you select a certain item in the database in the text ring 2, the price for that item in the new column will be retrieved. This is something like the vlookup in excel.

Please tell me if this is possible and if you could show me how, I would be really greatful.

Thanks.

0 Kudos
Message 3 of 9
(4,330 Views)

Yes, it is possible. Currently we are getting all possible matches with a "for" loop. Instead, if we just search and stop at the 1st match, and retrive the corresponding value, it would be what you are looking for. Try it, and let me know if you are facing any trouble.

------
Using LabVIEW since 2012. Certified LabVIEW & TestStand Architect
0 Kudos
Message 4 of 9
(4,319 Views)

What I'm looking for is a way to do exactly what it is being done right now, so that the for loop looks for every value, so that the second text ring gets filled, but if I select an item from the second text ring, I want to be able to grab the items price from the spreadsheet.

If you could please tell me how to do this, I would really appreciate it.

Thanks.

0 Kudos
Message 5 of 9
(4,300 Views)

By the way, your spreadsheet requires only 3 columns

		
DVDs	Maxell	5			
DVDs	TDK	6			
DVDs	Sony	8			
DVDs	Aiwa	9			
Mouse	Akai	6		
Mouse	Genius	7		
Mouse	OEM	9		
Mouse	Cimetech	8		
Printers	Canon	4	
Printers	Panasonic	6	
Printers	HP		3	
Power Supplies	Aerocool	10
Power Supplies	Antec		6
Power Supplies	Bgears		4
Power Supplies	Coolermax	9
0 Kudos
Message 6 of 9
(4,290 Views)

I currently just have 3 columns, but if I added a 4th column with the prices, how would I retrieve the price from the item selected in the 2nd text ring?

0 Kudos
Message 7 of 9
(4,284 Views)

Add an event for 2nd text ring value change in event structure. In this event, search the file for the item in the 2nd text ring, and retrieve its corresponding value(price) and display.

------
Using LabVIEW since 2012. Certified LabVIEW & TestStand Architect
0 Kudos
Message 8 of 9
(4,255 Views)

How Do I Programmatically Edit Items in a Menu Ring or Text Ring?:

http://digital.ni.com/public.nsf/allkb/FB0409491FAB16FA86256D08004FCE7E

 

The following snippet reads the first column in a CSV file, and populate a Ring control with the elements of the first column:

 SNIP.png

Let me know if this helps, greetings.

David P.
National Instruments
Applications Engineer
www.ni.com/soporte
0 Kudos
Message 9 of 9
(4,176 Views)