Sign in to follow this  
Followers 0
rajsiyer

Creating an array of String-variables in Citect 7.40

3 posts in this topic

Hi friends, I have this need to declare a few arrays of string variables and intialize them with a particular value, in Citect. In citect, on the forms for variable declaration, there is a place given for entering the array-size. In the case of other data-types such as INT or REAL, entering a number here will imply that the declared variable is an array with the size mentioned in the Array-size. In the case of string variables, the array size represents the size of the string ie. one element for 2 characters. If we declare the size of the array as an extension of the variable name, such as StrVariable_array[30] then Citect throws up a compile error. We are of course able to declare an array of string variables in the cicode editor, but then this is not 'Global' for use as variable tags. So the question begs.. How do you declare an array of string variables, preferably using local variables. Thanks for looking in, regards and best wishes.

Share this post


Link to post
Share on other sites
This is the size of the integer array to store the string in an IO device, not the string size. For IO devices with a string data type you do not need to worry about this. For a local variable: Name = strVariable_Array Array size = 30 Data Type = STRING This will give strVariable_Array[0] ...... strVariable_Array[29] However, Local variables are in memory and unique to a process, so will not retain the value and will be different between clients and servers in a multi process system. If you want the same data between processes and data to be retained, create a string array on a DISK IO type IO device.

Share this post


Link to post
Share on other sites
Thanks a lot Chelton.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0