Loading ...
Sorry, an error occurred while loading the content.

17675Re: [Clip] Re: Newbie seeks help with array processing

Expand Messages
  • Don - HtmlFixIt.com
    Mar 28, 2008
      you did read help under clip programming variables?

      ^!SetArray %VariableName%=ArrayData (added in v4.6)

      Similar to the ^!Set command but creates an array from the data assigned
      to it. By default, the data delimiter is a plain semi-colon (;), or a
      semi-colon and double-quotes separating each item. You can change the
      default delimiter with the command ^!SetListDelimiter (see below).
      During the assignment, the individual items from the ArrayData are each
      stored in a new variable with the same name as the base variable plus an
      index number reflecting their corresponding position. The variable at
      index 0 has a special purpose as it stores the actual number of items
      contained in the array. You can change the values of the individual
      indexed items by using the ^!Set, ^!Inc, ^!Dec commands, and the changes
      are reflected in the base variable. If you assign an empty value to an
      array variable, or use the ^!Set command to assign a new value to it,
      the array is automatically removed from memory.


      ^!SetArray %Array%="Value 1";"Value 2";"Value 3"

      The above instruction will create four new variables:

      ^%Array0% = 3

      ^%Array1% = Value 1

      ^%Array2% = Value 2

      ^%Array3% = Value 3

      If we assign a new value to the second item, as follows:

      ^!Set %Array2%=New Value

      then accessing the base variable ^%Array% will return:

      "Value 1";"New Value";"Value 3"

      The following assignment will destroy the array, and only the base
      variable will be preserved with the newly assigned value:

      ^!Set %Array%=Another Value
    • Show all 9 messages in this topic