LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing a local variable after each read

I want clear the value of a local variable(in this case a string) right after it's read. In this case the local is reading an indicator that's in another part of the VI.Can anyone help. Thanks in advance.

S
0 Kudos
Message 1 of 8
(4,077 Views)
Clearing a local is the same as writing an empty string to the indicator (or another local of it in write mode). Use data flow (may need the help of a single-frame sequence e.g.) to ensure that you have read the local before you write an empty string using another local...

If you have an indicator there must be a value going to it, most likely from a wire. Why do you use a local to read the value of the indicator instead of wiring the value to whereever you need it?
0 Kudos
Message 2 of 8
(4,077 Views)
You can use either of the two techniques shown in the attachment. Because there's no dataflow connection between locals, I used a sequence structure. If you use the property value to read and set, just make sure you connect the error out/error in connections of the property node.
0 Kudos
Message 3 of 8
(4,077 Views)
The VI is generating a polling command for multiple 485 devices. The responses are received via TCP/IP. The receive WHILE loop continuously listens fro the responses. Using a LOCAL is the only to get the responses out of the loop while they're being received. Thanks for the help. Now I have to figure out how to get an empty string to the indicator between responses.

S
0 Kudos
Message 4 of 8
(4,077 Views)
Dennis--
I don't see any attachments.

S
0 Kudos
Message 5 of 8
(4,077 Views)
I do. Are you using the Develoepr Exchange of NI Developer Zone or soemthing else? Attachments are stripped from comp.lang.labview using Google. The same thing probably happens with a news reader. I'll reattach in case there's something wierd going on.
0 Kudos
Message 6 of 8
(4,077 Views)
In such a case I would skip the indicator and local and use either a que or a functional global to receive the output from the TCP function.

If the TCP reads separate messages the que would be my first choice. If it just read the data as it is I would use a functional global to hold the traffic and add multiple methods to it. The reason why you use an indicator at all e.g. I assume is because sometimes you want to see the traffic. Instead of having an indicator in the reading VI though I would have a read method in the func.global that lets you read out the traffic to display it wherever you need it.
0 Kudos
Message 7 of 8
(4,077 Views)
As Mads comments, this is a perfect application for a queue (and a really bad application for a local!)
0 Kudos
Message 8 of 8
(4,077 Views)