LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

excel database

Solved!
Go to solution

Hi,

I'm a new user to LabVIEW. I have a .xsls file that contains cities in the first column, longitude in the second column, and latitude in the last column. I there a way that I can choose a city name in the drop-down menu style and function return the corresponding latitude and longitude to the selected city? 

thanks for helping me.

0 Kudos
Message 1 of 7
(2,063 Views)

Certainly. You have to read in your array, populate your drop down menu from the first column, and then use the index from your drop down menu to get the data from the other two columns. What have you tried? Is there somewhere that you are getting stuck? 

0 Kudos
Message 2 of 7
(2,046 Views)

depending on which version of LabVIEW you have, you could also use a MAP or a variant attribute look up table.  These options are probably overkill for you, but just take a glance and see what you think.

0 Kudos
Message 3 of 7
(2,028 Views)

based on what you said and little search I tried to import an excel file with a report generation toolkit and get value by "Excel get data" block. I'm using Ring control as the Drop-Down menu but it needs to insert city name(according to my excel file arrangement) one by one and due to the big number of cities its time consuming, is there a shortcut to do it quickly? 

0 Kudos
Message 4 of 7
(1,927 Views)

based on what you said and little search I try the report generation toolkit and "Excel get data" block. for the drop-down menu, I try Ring control and feed output value to my excel block to get data. but due to a large number of cities in my database, it's really hard to insert them one by one, is there a shortcut for that? 

I'm using Labview 2020 version. 

0 Kudos
Message 5 of 7
(1,958 Views)

@Salivan wrote:

based on what you said and little search I try the report generation toolkit and "Excel get data" block. for the drop-down menu, I try Ring control and feed output value to my excel block to get data. but due to a large number of cities in my database, it's really hard to insert them one by one, is there a shortcut for that? 

I'm using Labview 2020 version. 


Can you post your code? It would probably be best to use Save for Previous and save the file at least two versions back as many on this forum have not upgraded to the latest versions. 

 

I don't understand what you mean by "insert them one by one." You should read your data in as an array of strings and use that array to populate your ring control. In any event if you have something that you are doing repeatedly for a set number of times you should use a FOR loop.

Message 6 of 7
(1,940 Views)
Solution
Accepted by Salivan

The RGT returns the data as an array of a specified format.  I suggest that you read the Cities Column as a 2D array of string, and then read the other two columns as a 2D array of DBL.  Then index the Cities to write the 1D array to the Ring Control using the Property Node Strings[].  When the ring value is changed, return the ring value as an integer and index the second array to return the positions.  I usually insert the word "Select" as the first element of the ring and offset the index by one before looking up the position.

Cities.PNG

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 7 of 7
(1,921 Views)