10-25-2018 06:30 AM
@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.
10-25-2018 07:15 AM
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.
10-25-2018 09:52 AM
@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
10-25-2018 10:27 AM
Thank You Very Much.
10-26-2018 07:00 AM
10-26-2018 07:05 AM - edited 10-26-2018 07:13 AM
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.
10-26-2018 08:09 AM
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.
10-26-2018 08:10 AM
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.
10-26-2018 08:13 AM
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.
10-26-2018 08:16 AM
you can ignore this message, Iam going to use a global variable.