LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not Understanding Data Value References

Solved!
Go to solution
Solution
Accepted by topic author govindsankar

@govindsankar wrote:

Ok so I should use connector panes of subVIs which is in other words using a functional global variable.


No, those two statements are not equivalent.  You can just pass the DVR into a subVI using the subVI's connector pane.  Just branch the DVR wire (which is a reference to data) and pass it into all of the VIs that need access to that data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 21 of 47
(1,510 Views)

Thank you, could you be more specific. So I open a new VI and place the DVR inside and then use the connector pane on the right top of the front panel. I select one of the output terminal of the connector pane and then select the DVR to be that connector pane terminal value. Then I save it and use this VI anywhere I want to access the data. But if I change the value in DVR which I will definitely do, it will automatically update the value in the subVI ´with the DVR. If that works like that then my problem would be solved. 

0 Kudos
Message 22 of 47
(1,505 Views)

@govindsankar wrote:

Thank you, could you be more specific. So I open a new VI and place the DVR inside and then use the connector pane on the right top of the front panel. I select one of the output terminal of the connector pane and then select the DVR to be that connector pane terminal value. Then I save it and use this VI anywhere I want to access the data. But if I change the value in DVR which I will definitely do, it will automatically update the value in the subVI ´with the DVR. If that works like that then my problem would be solved. 


Yes, that's basically how DVRs work.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 23 of 47
(1,485 Views)

Thank You Very Much.

0 Kudos
Message 24 of 47
(1,472 Views)

Main ProgramMain ProgramDVR Sub VI with connector paneDVR Sub VI with connector pane

0 Kudos
Message 25 of 47
(1,451 Views)

Problem still not solved. I did the thing of keeping a DVR in a seperated vi and connecting it to the connector pane and the error I got is uploaded as a pic above, I have also uploaded how the pic of the sub VI looks and also the whole project. Kindly do help me, what am I still not understanding or what is it that I am getting wrong. 

0 Kudos
Message 26 of 47
(1,459 Views)

I have been constantly trying to figure out how to access the same data used at one VI, at multiple different VIs. I was told to use DVRs and from then the problem began. I learnt how to use DVRs, but couldnt find how to use in Class as everyone told me to keep the DVR inside the labview object. I tried that and finally I was told that put the DVR in a sub VI and access the Data from that subVI by using the connector pane. Any change to the DVR will be automatically updated, that is what I understood. I did this simple program within a class which has a DVR of the numeric value in its cluster of private data. Then I created the DVR using Create DVR VI which I programmed. Then I created the write DVR function, which writes to the DVR: Then in the main VI i connected the create DVR to write DVR and also wired a numeric value to the write. Then I used my DVR sub VI and connected the output connector pane of that to a numeric Indicator VI using the inplace element structure and now the error showing is the reference is invalid. So I have not understood DVR still not correctly. Can anyone help me what is the problem. I have attached the project as well as pics of the error and the DVR sub VI. Kindly do help me. Main VI with the errorMain VI with the errorFront panel of the DVR subVIFront panel of the DVR subVI

0 Kudos
Message 27 of 47
(1,452 Views)
Solution
Accepted by topic author govindsankar

Dataflow! What would connect the DVR in your 'DVR Sub VI' to anything?? How would LabVIEW know it should be linked to the DVR you created in the create DVR method?? Think Dataflow!

 

If you want to use the same instance of a class throughout your code without passing the class reference around by wire, you need to use some sort of global variable.

 

Message 28 of 47
(1,449 Views)

Ok then that is all I need to hear. So global vaiable is the way to go. I started this thread hoping that I dont have to use a global variable. I guess i will use a global variable. Thank You.

0 Kudos
Message 29 of 47
(1,446 Views)

you can ignore this message, Iam going to use a global variable.

0 Kudos
Message 30 of 47
(1,448 Views)