Access Violation Error When Using ChV Variable in DIAdem Script

Updated Aug 9, 2018

Reported In

Software

  • DIAdem

Issue Details

I use ChV variable for accessing values of a channel from Data Portal in DIAdem Script. Sometimes I receive access violation error when my script runs. Error window is similar to the following:



Why do I receive this error and what do I do wrong in my script?

Solution

Access violation error related with usage of ChV variable is often caused by accessing element of a channel, which is not declared. When your channel has 10 values and you will try to write the value on index 11, access violation error is going to be generated at runtime.

This is expected behavior as the documentation for ChV variable states that DIAdem does not automatically adjust the channel length when new values are added with the ChV variable.

Always check that channel has an expected number of elements before writing to it or use the ChnPropValSet command to set the channel length to avoid this error.

WAS THIS ARTICLE HELPFUL?

Not Helpful