04-10-2023 12:10 PM
Hi folks,
I'm working on exporting collected data to an Excel spreadsheet. I'm using the Report Generation tools. I've successfully achieved this before, a few months ago. The code would format the data in the Excel table the way I wanted and then save the Excel file.
I went to implement the same functionality in new code today, and it's now not saving to the spreadsheet.
What I observe: when I run the VI, it appears to execute, but produces no saved file at the end. If I set the `Create Report` to `maximized`, I can see Excel open a new spreadsheet in the background. After the spreadsheet is created and written to, the window closes and the spreadsheet apparently vanishes. I can find no evidence of the saved file on my machine.
When the spreadsheet is open, it appears to be populating with data. If I grab the Excel window (say by pausing the LV execution) I can save-as the filled-in table. I can manually save it to the path I specify, so I don't think the path is incorrect.
I wrote some experimental code a few months ago to do the same task. Out of curiosity, I tried the code that worked a few months ago, but that code does not work now either. No spreadsheet is created.
Two things that have changed since I wrote that code. I've moved to a new computer, and I've moved from LV2020 to LV2023. I transferred the code by Git, so whatever is on the old machine should be on the machine.
I'm including the "old" working code (file `Show Report.vi`), even though it is a mess, and a slimmed down VI with just the part I'm focusing on, to focus on just that part of the problem. The new file is `Write Data to Excel Spreadsheet`.
04-10-2023 08:38 PM
I don't have LabVIEW 2023 installed, so I cannot open your "Code that doesn't work". There are three possibilities for "why" it doesn't work -- there's something "bad" with the "improved" code, there's something wrong with the latest Version of LabVIEW, LabVIEW 2023, or there's something wrong with Excel on the new computer (seems unlikely, by your report ...).
What happens if you "Save for Previous Version" to, say, LabVIEW 2021 (which I, and other "old hands" at LabVIEW who don't upgrade every year)? You could test it on your new machine, and on your older machine. Also, if you post the back-saved "new" code, more of us could test it, too.
Oh, yes -- are you running 32-bit LabVIEW or 64-bit LabVIEW? If the latter, why? Can you try 32-bit?
Bob Schor
04-11-2023 08:48 AM
Hi Bob,
Thanks for the response!
After doing some investigation, the root cause appears to be LV2023 64-bit. I installed 32-bit LV on this machine and both the VIs execute as expected. Interestingly, the VIs also work on the 2020 machine, using LV2020 64-bit.
I used 64-bit because the system we'll run this code on is a 64-bit machine. The AMD64 extensions were released 20 years ago. My expectation is that in 2023 I'm writing 64-bit code, unless I'm writing for embedded or special hardware. But this experience, and the fact that you asked the question in the first place, suggests to me I need to adjust my expectations for LabVIEW. Is this an accurate assessment? Should I recompile everything to 32-bit? Only use 32-bit going forward?
As an aside, I've been out of the loop on LV/NI stuff for a while. Is there a place to get a quick catch-up on what's happened since 2016 or so?
Thanks!
04-11-2023 02:06 PM
Welcome back, Seth.
Since I-don't-know-how-long, all (most?) Microsoft Windows OS's have been 64-bit only (certainly 64-bit was what most, if not all, Windows 10 people ran) since 2020, and most LabVIEW developers have been using it even farther back in time. LabVIEW has gradually been moving to 64-bit full functionality, but I don't think it is quite "there" yet. Except in cases involving serious number-crunching (I recall a presentation on adjusting the mirrors on some of these large telescopes that use multiple "tune-able" small mirrors to synthesize really large mirrors that can "adjust" themselves to correct for atmospheric variations, involved doing massive numbers of FFTs many times a second, massive data acquisition + massive data processing = I Need More Memory!), most LabVIEW programs do not require memory addresses that require 64-bits.
The present versions of LabVIEW can be installed in both 32-bit and 64-bit versions. The 32-bit versions (almost) always work, while the 64-bit versions (usually) work (some of the time). You Pays Your Money and You Takes Your Choice.
Bob Schor