03-12-2013 09:02 AM
Hello everybody,
and please forgive me to bother you with such a simple issue -- but I am at a loss -- I just can not bring this simple code (see attached sreenshots) to work, and I really do not know why.
I can write data (i.e. a string) into a class (as checked with a probe), but I can not read the string out again. When I check with a probe on the class-cluster before the read-vi., the string is always empty (""). But after the write.vi the probe showed that the string was there before.
Any help is greatly appreciated, thanks a lot.
With kind regards,
B
Solved! Go to Solution.
03-12-2013 09:17 AM
Hey B,
You're reading the instance, which you're creating at the beginning of the while loop. Try a shift register
A little add on:
The information won't be available in the parent actor core. In the moment, when you split the wire, you're creating a new instance of that class. If you want to write information to the instance of your parent actor core, you need to create an accessor message and send the information to the parent actor class with that message.
Regards,
Michael
03-12-2013 09:22 AM
If you want each loop to start with the value from the last iteration you need a feedback node or a shift register for your class wire. Right now each iteration is using the initial value of the class object since it is a standard tunnel. I would right click the tunnel in and choose "replace with shift register". You will need to wire the output wire from your write method to the shift register on the right of the loop (after you create the shift register there will be one on the right).
Casey
Phoenix, LLC
CLA, LabVIEW Champion
Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!
03-12-2013 09:26 AM
Hello MMike,
:-)... that´s it... thanks.
Somehow I thought that in a Class the data is always there and up-to-date.. But apparently it (the class) only has those data in it that were present at the time of creating the concrete instance... if I understand that correctly....
Thanks!!!
🙂
Best,
B
03-12-2013 09:27 AM
I understand... thanks for your answer.
🙂
03-12-2013 09:31 AM
That is the big By-Ref vs By-Value question. If your class was storing data in a DVR, A single elemet Queue or some other by referen e me hanism, you would have been able to read it without using the shift register.
03-12-2013 09:39 AM
Yeah! This is, what made it difficult to me getting into LVOOP. But basically you have to see an instance of a class as variable, while the class is the data type. I never use this, but I think you could create a control for the class and manipulate the data by reference.
03-28-2013 04:55 PM
mike-o-tronic wrote:
Yeah! This is, what made it difficult to me getting into LVOOP. But basically you have to see an instance of a class as variable, while the class is the data type. I never use this, but I think you could create a control for the class and manipulate the data by reference.
You... could. Please don't. You'll just get yourself into a bind where you're asking for help solving your race condition problems. If you need by-reference, use the Data Value References.