LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to view an appending table from a sub_vi?

I have an array of results that appends to a table every minute. This loops round 17 times then stops. On the subvi front panel, i can view these results being appended into the table row by row every minute. My problem is when i go up a level and place an indicator/table on the subvi`s table o/p, the table does not append every minute any more. It only completes the table when the sub_vi executes.
Does anyone know of a way round this. I have attached an example of my code inside the sub_vi.
Thanks
Grant
0 Kudos
Message 1 of 8
(3,413 Views)
Salutations Grant,

This is a tricky subject, I will have to agree. Just the other day I was monkying with something along the same lines. It seems, one way to do this is to use global variables. Yes, a slightly dirty subject amongst labview users, Global Variables will provide a legit solution. However, you must make sure to work things out time wise. Because, as soon as you run the program, the global variable will start sending out it's information. So, maybe use a wait timer with a while loop or something along those lines to control how often the global variable attempts to pass out it's information. The while loop will ensure it continuously runs, maybe just wire a "Stop Button" to terminate the while loop? This should work, especially since you already know how often you want to update the table.

Oh, you must put the global variable inside the for loops or while loops that are inside the sub vi of course.

Hopefully this puts you on some good starting grounds,
ElSmitho
0 Kudos
Message 2 of 8
(3,406 Views)
There are at least 4 methods :
1/ Global variable,
2/ Reference and property node,
3/ Queue,
4/ Type 2 Global variables.

If you search the NI data base with these names as key words, you will find hundred of contributions on the subject.
The last two methods should be choosen preferably since they are more efficient when working with large data structures.

The attached vi is a small illustration of all these methods.

CC
Chilly Charly    (aka CC)
Message 3 of 8
(3,398 Views)
I could not open your VI because I only have 7.0. Just to let you know globals are ok in moderation and in some instances, I have been programming in labview for a couple of years and only had to use them once or twice. there are a couple of different ways to accomplish want you want to do. the easiest way to do this without using globals and taking up to much memory is to pass references to the subvi. What you will want to do is in the main vi right click on the table and select create reference. then in you subvi create a control reference on the front panel and reference it to a table control, then on the block diagram create a property node and set it to value, then take the same data you are writing to the table in your subvi and pass it to your property node you just created. Here is an example written in 7.0


CC Beat me to posting well thats what happens when you have the reply window open and have to go do something and come back to it

Message Edited by jhoskins on 04-19-2005 09:44 AM

Message Edited by jhoskins on 04-19-2005 09:47 AM




Joe.
"NOTHING IS EVER EASY"
Message 4 of 8
(3,393 Views)
I have attached a clearer example of my problem. If you run MAIN.vi, you can see that the results are not entered into the table until the sub_vi has executed. If you open up the sub_vi, you can see that the results are being appended every second.
0 Kudos
Message 5 of 8
(3,386 Views)
This is normal and expected behavior. I would recomend that you look at the examples CC and Joe posted. Here's your example modified to use a control reference.
Message 6 of 8
(3,366 Views)
Thanks all for your speedy replies.
0 Kudos
Message 7 of 8
(3,360 Views)


@jhoskins wrote:
...CC Beat me to posting well thats what happens when you have the reply window open and have to go do something and come back to it<



Hi Joe !
Should I tell you the number of times that b...y tst has posted a reply before me ? 😄

CC
Chilly Charly    (aka CC)
0 Kudos
Message 8 of 8
(3,349 Views)