From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

populate updatable drop down list based on files in the folder path

Hi, 

 

I am a beginner in labview. I am stuggling on where to start.

 

Here's what I need to do. 

 

I want to create an updatable drop down list. It can be automatic upon opening the program or manually update by clicking an update button. The drop down list will list all the filenames that are in .cvs format. These files are stored in a folder path.  Insider the folder, they are stored in different subfolders, the drop box should be able to find those files inside the subfolders. Once the user select a filename from the list, the program will read the data inside that file and import into an array so I can display the data. 

 

I have an idea on how to display the data, but I don't how to populate the drop down list based on the files in the folder, make it updatable and then import that user selected file's data into the the array. 

 

Can anyone help me with this? 

 

Thanks, Ruth

0 Kudos
Message 1 of 17
(5,547 Views)

Use a Menu Ring.  To update its list, you use a property node.  The property you need to set is Strings[].  It is an array of strings that populate the available items.

 

To find your file names, use Recursive File List.vi.  It is found in the File I/O->Advanced palette.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 17
(5,518 Views)

Hi Ruth,

 

Here's what I need to do.

You need to program it using LabVIEW…

 

- Use ListFolder to get all files of the current folder.

- Use RecursiveFileList to get files/folders recursively with all subfolders included.

- Depending on requirements I would use a listbox or a tree control to present the file structure to the user. Both are control by it's properties/methods…

- You can detect user selections in those controls with an event structure.

 

- Please ask specific questions on specific problems. We will be glad to help you.

- Provide a VI to show what you have done so far. Nobody will do your job of coding this…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 17
(5,517 Views)

Yup, ListFolder with a pattern of *.csv.  Then use a property node on a combo box or ring to set the items in the drop down.  Here is some free training if you are interested in learning more general LabVIEW tools.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-LabVEW Basics

-DAQ Application Tutorials

 

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

0 Kudos
Message 4 of 17
(5,497 Views)

Thanks all for the help. So I was able to populate the combox but now I have a question on the array.   

 

So the data I imported has different types of information but I am only interested in certin range of the array which has the currents measurment. I want to find the maximum value in each columns and do some calculations to find the RMS currents.  The index where the measurement start and end will vary for each file. I wonder if there is a function that I can extract the specific range of array into a different array to simply what i have right now? 

 

From the block diagram I attached, I am using the array size to tell me how many rows the imported array has. Then I use the number of rows minus the index where the last measuremnt is at. This tell me how many rows I need to delete using the delete from data function. I do similar steps to delete rows before the measuments. After that I use the max and min to help me find the maximum values at the first column.

 

what I have so far kind of work for files with only one set of measurement. When the files will multiple set of measurments which make the array size super big, the number of rows property node doesn't seems to work properly. I am getting red dots on couple terminals and i don't know why. When I put a probe to look at the value coming from the array size and the number of rows, they don't match..... for example: The array size function says I have 6270 rows, but the number of rows property node is giving 1. 

 

To sum up, my question is 

Why is the value of the # of rows property node  and the actual # of rows from the array size output missmatched? 

Is there a simpify  way to extract range of data inside the array? 

 

Thanks  

0 Kudos
Message 5 of 17
(5,441 Views)

Hi Ruth,

 

no diagram attached, no specific help…

 

I guess you mixed up the number of visible rows with the number of rows in the array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 17
(5,419 Views)

ruthlcw wrote:Why is the value of the # of rows property node  and the actual # of rows from the array size output missmatched? 

Is there a simpify  way to extract range of data inside the array?


The property node just returns how many items are visible on the front panel.  The Array Size returns how many elements are actually in the array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 17
(5,401 Views)

Hello, friend, I would like to have a droplist to list folders in a specific path, select the folder name, the second droplist will list all the files in this folder. Right now I can only list all the files in one folder. Inside RC_Data, it should have two folders RC_TO and RC_TT. I'm trying to put another case structure, I failed. Can you help me on this? Attached is how I did to select files from a path. Thank you. select files.JPG

0 Kudos
Message 8 of 17
(4,541 Views)

Hi Xiao,

 

Your path constant already has RC_TO in it, you need to go up one level to RC_Data if you want to find RC_TO as a folder. Then switch the output of List Folder to the one right below the one you are using, it should be folder names instead of file names.

0 Kudos
Message 9 of 17
(4,536 Views)

Thank you, this way, I can select two folders from the upper-level path, I would like to have another droplist to list the files inside the folder and select to view. I'm trying put another case structure inside the upper right one. select files.JPG

0 Kudos
Message 10 of 17
(4,526 Views)