Create a user-defined string data type

Use user-defined string data types to create a data structure that stores ASCII characters for use in your machine or process. There are three pre-defined string data types:
  • STRING: Stores up to 82 characters.
  • STRING -32: Stores up to 32 characters.
  • STRING -16: Stores up to 16 characters.
You can also define a custom string data type to store between 1 and 65,535 characters.
Each STRING data type contains these members:
Member
Data Type
Description
Notes
LEN
DINT
Number of characters in the string.
The LEN automatically updates when using:
  • The Tag Editor or Property panel to enter characters
  • Instructions that read, convert, or manipulate a string
    The LEN shows the length of the current string. The DATA member may contain extra, unused characters, which are not included in the LEN count. Escape sequences (for example, $00 for null) count as a single character toward the LEN, so the visible characters in the string might not match the LEN exactly.
DATA
SINT array
ASCII characters of the string.
The SINT array holds the character data for the string.
Each element of the DATA array contains one character as an encoded decimal value. To access characters, use the tag name (for example, string_1.DATA[0]).
Create new string types to store more or fewer characters.
To create a user-defined STRING data type
  1. In the explorer bar, select
    Library
    .
  2. Select the
    User-defined Strings
    folder and select
    New string type
    .
  3. In
    New user-defined string type
    , enter:
    • Name
      . Enter a name for the data type. Enter a maximum 40 characters that comply with the IEC-61131 Name Standard.
    • (optional)
      Description
      . Enter a description of the data type.
    • Maximum characters
      . Enter the maximum number of characters that the string data type stores. You can enter a value (or use the selector buttons to designate a value) up to 65,535.
    • (optional)
      Version Number
      . Use to track changes made to a data type by version number.
    • (optional)
      Vendor
      . Enter a name for the vendor.
    • (optional)
      Version Note
      . Enter a description to help identify changes made for the version.
  4. Select
    Create
    .
FactoryTalk Design Studio Copilot and user-defined strings
All FactoryTalk Design Studio Copilot interactions with strings are from the FactoryTalk Design Studio Copilot chat panel.
  • Create user-defined strings
    Prompt
    : Create a user defined string called ST_001, with a description [enter description], maximum characters of [1 to 65535], version [x.x.x], Vendor is [name], and Version Note is [note on version].
    FactoryTalk Design Studio Copilot response:
    A warning that FactoryTalk Design Studio Copilot cannot complete this prompt if one of these scenarios exist:
    • The name is already used or is invalid.
    • The Property value is not valid.
  • Create string tags
    You can enter a prompt to create string tags with the Data types of String, String_16, or String_32.
    Prompt
    : In [smart object name].[program name].[routine name], create tag [tag name] with type String (or String_16 or String_32)
    FactoryTalk Design Studio Copilot response
    : A warning that FactoryTalk Design Studio Copilot cannot complete this prompt if one of these scenarios exist:
    • The name is already used or is invalid.
    • The Property value is not valid.
  • Create a string tag array
    Prompt
    : In [smart object name].[program name].[routine name], create tag [tag name] with type String with array dimension 6
    FactoryTalk Design Studio Copilot response
    : A warning that FactoryTalk Design Studio Copilot cannot complete this prompt if one of these scenarios exist:
    • The name is already used or is invalid.
    • The Property value is not valid.
  • Add value to string tag
    Prompt:
    In [smart object name].[program name].[routine name], add value of [string] into tag [tag name]
    FactoryTalk Design Studio Copilot response
    : A warning that FactoryTalk Design Studio Copilot cannot complete this prompt if one of these scenarios exist:
    • The name is already used or is invalid.
    • The Property value is not valid.
Find information about FactoryTalk Design Studio Copilot prompts for:
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal