LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File not found becuse excel file become RandomName.tmp and original file disappears

Hello All,

 

I am using .xlsx file to store the result of my testing and I have observed that at some point my file becomes .temp file and then original file no more exist.

 

Original filename is VCP Report.xlsx

 

please see I am attaching my code for reference

 

 

excel file error.PNG

 

I am sure the of the file given by me is correct just the file is missing somehow, it happened many times.

 

file error.PNG

 

attached VI is LV15, 64 bit.

 

If you can suggest some solution that wil be great.

 

Thank you.

 

 

 

 

 

-
Amit
CLAD
0 Kudos
Message 1 of 5
(4,380 Views)
I can't look at your code because I am on my phone, but it sounds like maybe the update process is failing and all that is left is the temp file that excel creates.

Are you sure all errors are getting propagated properly? When exactly does the file disappear? What is the code doing? Where are the files you are working with located?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(4,367 Views)

Sorry to do this -- I just noticed I'm late for a meeting, but I think I understand what went wrong.  I'll be back this afternoon.

 

Bob Schor

0 Kudos
Message 3 of 5
(4,362 Views)
AAAAAGGGGHHHHHH!!!

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(4,361 Views)

How embarrassing!  I cannot get your code to fail!  Plus I realize that the bug that I found (and fixed for myself when I couldn't get anyone at NI interested in it) doesn't really apply in this case.

 

So here's what I tried.  I modified your code slightly, putting a test to see if the output file already exists before wiring it as a Template for New Report (if it doesn't, I wire an Empty Path).  I also explicitly create an array of 10 random numbers as strings (to have real data).  I ran this a number of times, including some with Close Report = T, others with Close Report = F, and always saw Excel closed.

 

I was about to say that using Normal or Maximized in New Report didn't make any difference, other than having Excel "flash" momentarily, but found that if I did things in some as-yet-unclear pattern (involving changing Close Report, as well), I could change the behavior from "Flash Excel, but close when program exits" to "Leave Excel open on exit".  Frankly, I think we're dealing with the same Bug I found previously.

 

Before I tell you about the Bug, let me tell you about my Test Environment (I actually tested this in two environments, but it looked similar).  Here I'm using Windows 10, Excel 2013, and LabVIEW 2015.  My Office PC (which I just reached via Remote Desktop) is Windows 7, Excel 2010, and LabVIEW 2015.  We discovered the Bug when developing code in LabVIEW 2012 -- the code has since been "ported" to LabVIEW 2014.

 

So here's our situation -- we use Excel primarily as a "set of instructions" for behavioral experiments that might contain a hundred "trials" governed by 120 parameters.  Each row of a Trials Worksheet contains the parameters for a specific Trial.  We also have a few columns at the end of the Trials Worksheet where we record some redundant data, such as Reaction Time and "pointers" into the simultaneously-recorded LabVIEW files (e.g. how many analog samples did we collect, how many Events did we record).

 

When the last trial is presented, the Experimenter gets a message "Experiment Done", and can Exit the program (close Excel, close the Program), Restart (Close Excel, return to the beginning of the Experiment to do another one), or can choose to repeat any of the previous Trials (leaving Excel open).  During the Experiment, the Excel Workbook was left open (on a second Monitor) to allow the Experimenter to see all of the Trials and Results.

 

What we discovered was that if the Experimenter manually closed the Excel file before telling the Program to Exit or Restart, the Close/Dispose set of actions would basically rename the just-created Excel Workbook, delete it, and then complain that the original file was missing.  I traced the problem to some routines deep inside the RGT, where LabVIEW assumed that Excel was still running when it did some of its cleanup activities.  I ended up writing a "Save Excl if not Closed" routine to replace Save Report to File.  It uses its own auxilliary routine WorkBook Active, that returns True if Excel is, indeed, in memory and active (meaning it is safe to call Save Report to File, as long as there's a Report Path specified).  Here they are:

Workbook Active.png

Save XL if not closed.png

One suggestion I'd make about your example -- I use Excel Easy Table (instead of Insert Table), as it also allows numeric inputs and facilitates working in a loop to add "rows below" or "columns to the right".  Note that the MS Parameters you get from Get Last Row have as the first element of the Cluster the Excel Position you'd wire in to the Start Location.

 

Sorry I couldn't reproduce your failure, but perhaps my experience will lead to an "Aha!" moment ...

 

Bob Schor

0 Kudos
Message 5 of 5
(4,338 Views)