10-23-2025 08:26 AM
I've written a program that searches through my company's collection of Test Data .txt files for a particular serial number, entered by the user, and returns PASS/FAIL information. The test data is stored on a network drive, and searching for files manually in Windows Explorer can take MUCH longer than my program.
I've got a user that can't seem to get any data out of my program, and it seems to be a permissions issue, except that she has "Read" access to the folder, evident by the fact she can open and copy and move files from the test data folder to locations on her C:\ drive. This user is working remote, and has to VPN into the server I believe, but I'm not entirely sure how that works in my company. Other users of this program inside my facility do not have the same issue, but I don't have access to see their Windows folder permissions to be able to compare.
Here's my code:
This portion of the code is pretty basic, just concatenating a file path onto a Serial Number to be searched, along with some test-type characters, then an iteration (each time a test operator re-runs a test, the test data name iterates) followed by the .txt extension. In normal operation, while loop will iterate once more than the number of copies of a serial number test, so if there's only one copy of the test data, the while loop iterates twice. I put the "Search Array" in there for debugging, when I run the program I get a "0" in the first index and a "7" in the second index, which is expected, but my problem user gets a "7" in the first index, indicating it fails to even open a test data file once.
As you can see, I'm using the "OPEN" and "READ ONLY" options, and I read that to mean as long as the Windows user has "READ" access to a file or folder, this operation should work? Do I need to include some kind of timing buffer to account for her remote-ness? Am I going to need to wade into the morass of Windows File Security and Corporate Permissions?
Thanks in advance for your advice and wisdom!
Solved! Go to Solution.
10-23-2025 09:40 AM - edited 10-23-2025 09:41 AM
(In general, it is difficult to debug code pictures.)
10-23-2025 11:25 AM
(In general, it is difficult to debug code pictures.)
10-23-2025 12:06 PM
You might want to consider using Create File with Incrementing Suffix VI as it does the work of keeping track of the next number to increment for you.
But give us an example of what a standard path and filename looks like, that might help in figuring out the permissions issue.
10-23-2025 12:38 PM
I totally thought I put that in my original comment! Here's what a typical file looks like:
C37370-0-DCRF.txt
where C37370 is the Serial Number, 0 is the test iteration, and DCRF is the type of test run.
Sorry about that oversight!
10-23-2025 12:48 PM
@Wiley85 wrote:
I totally thought I put that in my original comment! Here's what a typical file looks like:
C37370-0-DCRF.txt
where C37370 is the Serial Number, 0 is the test iteration, and DCRF is the type of test run.
Can't you do a "list folder" with "C37370-*-DCRF.txt" as pattern, then search through the output? (There is even a recursive file list version).
I also strongly recommend to pad the test iteration with a sufficient number of zeroes (e.g. 0000, 0001, etc.) such that alphabetical sorting=numerical sorting.
10-23-2025 12:57 PM - edited 10-23-2025 01:06 PM
@Wiley85 wrote:
- Wy would you need to read the same array local variable with every iteration of the outer loop? Is there a chance that it can change during iterations? Wouldn't it make much more sense to just autoindex on that array?
On that outer loop, a separate vi is filling in different filepaths to the concatenate string, and they don't necessarily index well. Each time I use a different filepath for where test data is stored, I need to use the same set of serial numbers provided by the user.
Sorry, I don't understand your explanation. Auto-indexing on an array is functionally identical to indexing into the array with [i] (and you don't even need to wire N unless you don't want to process all elements. reading from a local variable in an inner loop is dangerous because you can't know if the value changes mid-stream, potentially breaking everything. it is also inefficient, because the compiler must assume that it can change at any time. What if you are at iteration 100 and the local variable turns into an empty array?
Compare:
10-23-2025 01:04 PM
I guess maybe I misunderstand the question. The local variable doesn't change while the program is running, and will likely never contain 100 entries, it's simply a list of serial numbers the user wants to check for test data. In a previous section of my code, I've given the user the option to enter just a single serial number, a range of serial numbers, or a scattered list of SN's, all of which get shoved into that local variable for use by this portion of my code. In diagnosing this issue, I replaced the local variable with a simple tunnel from the previous section to hopefully eliminate the inefficiencies mentioned, and the code still does what I expect.
10-23-2025 01:08 PM
@Wiley85 wrote:
I totally thought I put that in my original comment! Here's what a typical file looks like:
C37370-0-DCRF.txt
where C37370 is the Serial Number, 0 is the test iteration, and DCRF is the type of test run.
Sorry about that oversight!
Sure but what is the complete path. C:\blah\blah\blah\blah\C37370-0-DCRF.txt
I ask because I have had path issues cause Error 7
10-23-2025 01:11 PM
Below are some of the filepaths searched in order:
B:\A_GPSS TEST DATA\TEST DATA\Fin Good Test Data\
B:\A_GPSS TEST DATA\TEST DATA\Fin Good Test Data Archive\
B:\A_GPSS TEST DATA\TEST DATA\Fin Good Test Data Archive 2025\
B:\A_GPSS TEST DATA\TEST DATA\Fin Good Test Data Archive 2024\