LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 7 with "Read from Spreadsheet File.vi" inside a sub panel

I searched a lot before posting this but I couldn't find any similar post. The problem I'm facing is that I have a sub panel that should load the last session data to a table control. To do so I put a "Read From Spreadsheet File.vi" that should read from the file saved in last session. The problem is that when the caller loads the sub panel I get the Error 7 message. While I was testing it I even tried to put a file constant and browsed to the file in order to make sure the path was correct but didn't work.

 

In order to identify the error source I've opened the sub panel vi and highlighted the execution then no error occurs. I can't figure out why with the sub panel VI opened it ran fine but when it loads from the invoke node the error happens. I hope someone can help.

Download All
0 Kudos
Message 1 of 6
(3,005 Views)

Are you able to attach some VIs which reproduce this behavior? I tried this on my computer in LabVIEW 2016 but didn't get any different behavior whether or not it was run from an invoke method and put in a subpanel.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 6
(2,983 Views)

Could you please post the entire two VIs?  Pictures of part of the VI are not very helpful -- we can't "poke" at the wires or diagrams, or easily try making changes to the code and doing our own experiments to help you.

 

Bob Schor

0 Kudos
Message 3 of 6
(2,950 Views)

Ok. Here are the two related VIs. The application is a bit complex so I'm not sure if these two VIs would help. Feel free to comment on anything that could be better, suggestions of best practices are always welcome.

Download All
0 Kudos
Message 4 of 6
(2,909 Views)

I have a couple of comments.  

  • I'm not sure I could find the sub-Panels on Main's Front Panel.  When I clicked on Sub Panel Dados's Insert VI function and said "Find Control", it seemed to overlap with the Tab Control.
  • Tab Controls are not easy to use, and not particularly robust.  If you have a Sub-Panel and two running VIs, Dados and Display, you can easily have a Boolean Switch that controls which one of them appears in the sub-Panel without affecting their on-going execution.  This will probably work much better for you than trying to mix Tabs and Sub-Panels.
  • It looks like you want to start Dados and Display as independently-running sub-VIs and just let them run.  I much prefer using Start Asynchronous Call to do this rather than the much older Run VI method, and using Static VI References to get the File Path.  One advantage of this method is that it will work both in Development Mode (where you code LabVIEW) and in Execution Mode (if you build an Application).  Here's what the code to start Dados running looks like:Spawn Dados.png
  • The way the above Snippet works is that you start with a Static VI Reference, right-click it and choose Browse to Path, then find your VI (Dados, in this example).  Right-click again and make sure to make it a Strictly Typed VI Reference (which puts the Red Star on the icon).  Wire the Reference to a Property Node, choose "Path", wire the Path to an Open VI Reference and the (strictly-typed) Reference to the "Type" input.  You also need to wire Hex 80 to create a Reference for Start Asynchronous Call (and Forget).  Finally, the Start Asynchronous Call will start your VI running "asynchronously".
  • Do the same for Display.  Save the two References to Dados and Display.  To see one of them in your (now single) sub-Panel, decide which you want to see and wire that reference to the sub-Panel's Insert VI Method.  You can also use Remove VI to remove it from the sub-Panel (it still will keep running).

Bob Schor

Message 5 of 6
(2,893 Views)

Thank you very much for your help! The problem was a mistake with the relative path, although I applied your suggestion of using "Start Asynchronous Call" because it is much better not have a relative path.

0 Kudos
Message 6 of 6
(2,837 Views)