Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

Using BindTo for Buffered Data

  • Last UpdatedMar 22, 2021
  • 1 minute read

When working with indirect scripts to read the .buffer property of an attribute, the BindTo call needs to be used in startup instead of using it in execute. Using BindTo in execute can lead to losing the data in alternate buffers. The following snippets show an example of using an indirect to process a buffer. In this example, the BindTo call is in Startup and FOR EACH is in Execute.

When binding to an on-engine attribute, the whole script could be put in Execute. In this example, the BindTo call is in Startup and FOR EACH is in Execute.

In Declarations:

dim x as indirect;

In Startup:

x.BindTo("me.attribute1.buffer");

In Execute:

dim vtq as ValueTimeQuality;

for each vtq in x

LogMessage(vtq.value);

next;

When binding to an off-engine attribute, it may take more than one scan cycle to bind and the quality of the Indirect variable must be inspected before attempting its use. When binding to an off-engine attribute, declare the reference as indirect, and test the off-engine reference quality in the body of the script. You can use a WHILE-triggered script to ensure execution, illustrated in the following example. For more information, see Binding to Off-engine Attributes in the AVEVA Application Server Scripting Guide.

In Declarations:

 

dim x as indirect;

dim y as boolean;

 

In Execute (while true: me.z):

 

if not y then

'This could also be done in the startup script

x.BindTo("Object1.attribute1");

y = true;

endif;

 

if IsGood(x) then

LogMessage(x);

me.z = false;

endif;

TitleResults for “How to create a CRG?”Also Available in