From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

SubVI runs in highlight execution mode or on it's own but crashes with unknown error if run in main code

Hi Everyone,

I'm trying to gather data from an excel file using a Vlookup type code (Please post one if there already is one, I have looked in the forum but not seen one)

When I run the main program "search excel.vi" the 2nd subvi doesn't run. However it does run when I either have the subvi in highlight execution or if I just run the subVI.

Any help appreciated. I have attached all VIs and excel sheet

Pete
Systems engineer (CLAD LV2013)
0 Kudos
Message 1 of 4
(2,503 Views)

basic excel file to test

PS I'm running labview 2012

Pete
Systems engineer (CLAD LV2013)
0 Kudos
Message 2 of 4
(2,502 Views)

One possible cause could be that currently the order of "Close Reference" nodes is not determined. I modified the "Read_Values_From_Excel.vi" to control execution of close reference -nodes with error wires and to close references after they are not needed. After this I was not able to replicate the error when running the main VI. See the attached VI. You could try to make to same changes also to write subVI and run some tests to see if the error is gone.

 

Couple of additional points:

- There is no need to use "Build Array" for errors. "Merge Errors" can be expanded to have additional error inputs.

- Currently Excel is unneccessarily opened and closed in each subVI. Code could be modified to pass the reference to opened Excel sheet from "Read_Values_From_Excel.vi" to the "Write" subVI. This way Excel would remain open and the execution speed is improved.

- While Loop in "Read values from Excel Arrayed.vi" is unneccessary

 

0 Kudos
Message 3 of 4
(2,476 Views)

In addition to the specifics you got in tne other reply, a more general point is that anytime you see that code only works with execution highlighting turned on, you should be immediately be thinking "race condition".

 

Be on the look out for things that have to happen in a particular order, but that order isn't logically or explicitly enforced in the code. Remember that LV is inherently parallel and doesn't follow any sort of left-to-right, top-to-bottom execution order.

 

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 4
(2,465 Views)