LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -2147352567 when using Save Report vi

Solved!
Go to solution

Hi,

 

I'm developing an end of line test bench software for a firm. Things were going fine till I came across an unexpected error which I fail to comprehend. My code runs a motor simulation and saves the data in two separate excel files. When I have the path disconnected from the Save Report to File.vi (screenshot 1), my program runs smoothly and saves one of the files and returns an error due to the Save Report vi being disconnected (as expected). But when I connect the path to the Save Report to File.vi, I get an error -2147352567 (screenshot 2) at an append table to report.vi elsewhere in the code, which worked perfectly fine before the path was connected to the Save Report vi. Also, now the second excel file gets saved because its path has been connected. I cannot understand what the issue is. I could not find any source that gave me a reasonable fix to the problem either. I have been using Labview for less than 2 weeks, so forgive me if I have overlooked anything.

0 Kudos
Message 1 of 17
(6,119 Views)

Hi DPac,

 

Good morning, thank you for your post and welcome to the NI Forums.

 

I would like to reproduce your issue and the error you're experiencing, if possible please attach a copy of your VI's in a ZIP file attachement to a post, I will then be able to view your code and see what could be causing the the issue.

 

Best Regards

Jamie S.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 17
(6,086 Views)

Thank you very much for offering to help Jamie. I shall attach the folder with all the files required to run the code.

 

Please note that you will have to change the path at 7 different places in the code, based on where you save the folder on your hard drive.

 

Regards,

DPac

0 Kudos
Message 3 of 17
(6,081 Views)

Hi DPac,

 

I am looking at your VI now and trying to reproduce your error. Could you please tell me where the spreadsheet files that you are using to compare the torque, temperature and efficiency data in the "compare array to spreadsheet data.vi" are? 

 

I will also point out at this stage that even with the path disconnected from the Save Report.vi, the error is still being produced once execution is allowed to continue.

 

Thank you,

Eden S
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 17
(6,066 Views)

Hi Eden,

 

The comparison files are text files and you can find them in the folder called 'excel stuff'. To reproduce the error, please follow the steps:

 

1. Change the path (in 7 places) to whichever location you have the folder copied to.

2. As you can see, one of the save file paths is disconnected (path to save the excel file 'All Saved'). When you run the program, you can see that both excel files are filled in properly and one of them gets saved with the serial number as the file name and the other one does not get saved due to the path being disconnected (which is expected). You can see that excel file with the serial number has all the sheets filled up as required.

3. Next connect the path to the excel file 'All Saved'. When the program is run in this condition, it throws up the error 2147352567 at the 'append to table.vi' of the other excel file, which worked perfectly fine earlier. Now you can see that the excel file with the serial number filename does not have anything in the first sheet, but has values in the other sheets.

 

Hope this information helps for you to reproduce the error.

 

Regards,
DPac

0 Kudos
Message 5 of 17
(6,058 Views)

Hi DPac,

 

I have replicated the error and the program was acting as you stated. The error was occurring at the "append table to report.vi".

 

I isolated the issue by allocating a true constant to the "display alerts?" input of "new report.vi". I believe the problem is the template being used in both "new report.vi" instances. As the same file was being used, LabVIEW was trying to access this template spreadsheet simultaneously in two instances. 

 

I then saved a copy of template.xlsx named template2.xlsx and set one of the template inputs to the copied version. This stopped the error and the program now saves two spreadsheets - one with the name allocated and the second with the SN as the name. 

 

Can you please confirm that this fixes the issue and the program is now running as expected?

 

 

*EDIT*

 

The error is still occurring intermittently, apologies. I am looking in to why this is only occurring sometimes.

 

 

Eden S
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 6 of 17
(6,042 Views)

Hi DPac,

 

As the error was only occurring intermittently I have assumed that it was due to race conditions. As there was no data flow between the report writing code, there was no way of knowing which section would run first. This was obviously causing one of the functions used in "Append Table to Report.vi" to occasionally attempt to run more than once at the same time which was producing the error you mentioned.

 

To counter this simply wire "error out" of the "Save Report to File.vi" for the summary into the "error in" of the "New Report.vi" for the report saved as the serial number. This forces the first write code to always operate before the second, eliminating the race issue.

 

Please tell me if this has worked,

 

Thank you,

Eden S
Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 7 of 17
(6,027 Views)

Hi Eden,

 

I didn't quite understand your solution. The templates used by both New Report.vi-s are different. One is called 'Template.xlsx' and the other is called 'All Saved.xlsx'. You can see them if you go through the path strings of those vi-s. The program is intended to use 'Template.xlsx' to save a report file with the serial number. The 'All Saved.xlsx' collects and saves all data collected during the execution of the program. So the template used for the second New Report.vi is 'All Saved.xlsx' as data has to be added to the end of it every time the program is executed. So the same template has not been used for both the New Report.vi-s.

 

If you could explain your solution once again, I will try it (or maybe send the program to me so that I can try it out?).

 

Regards,

DPac

 

 

 

0 Kudos
Message 8 of 17
(6,023 Views)
Solution
Accepted by topic author DPac

Hi DPac,

 

Apologies for the confusion in the earlier post, thank you very much for clearing it up.

 

Following my last post; the error was due to a race condition. There was no data flow used between the two separate report files being written. This means that LabVIEW will try to perform the two bits of code in parallel. However, this was occasionally causing one of the sub-vis to be called by the two different parts of code at the same time, which was causing the error.

This is why the code would run without the above error if you disconnected the path to the first "Save Report to File.vi", as this part of the code wasn't running, allowing the second part to run freely.

 

To counteract this I simply wired the "error out" terminal of the "Save Report to File.vi" (the one which used All_Saved.xlsx) into the "error in" terminal of the "New Report.vi" (the one which used Template.xlsx). Because VIs cannot operate until all inputs are filled, this forces the writing of the first report to occur before the writing of the second report, not at the same time.

 

I have attached the revised version of "EOL_V1.vi" where you will be able to see the how I have wired the errors to force execution.

 

 

I also noticed that you have not initialised your "set speed" shift register. This means that each time you run the program it will retain the last value from the previous run. Is this intentional? This means that your spreadsheet does not update correctly if you were to run the program twice in a row.

 

Thank you,

 

 

Eden S
Applications Engineer
National Instruments UK & Ireland
Message 9 of 17
(6,016 Views)

Hi Eden,

 

Thanks a lot for your help, I'm delighted to let you know that your solution worked brilliantly. You're great mate!

N regarding the 'Set Speed' shift register, I had initialised a value to it after I had attached the code in the discussion forum. Cheers for it anyway.

 

Regards,

DPac

0 Kudos
Message 10 of 17
(6,003 Views)