Jump to content

Recommended Posts

Posted
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.
Posted
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.
Posted
Thanks a lot Chelton.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...