@Elements (Formula Language)

Calculates the number of text, number, or time-date values in a list. This function always returns a number to indicate the number of entries in the list.

Syntax

@Elements( list )

Parameters

list

Text list, number list, or time-date list.

Return value

numElements

Number. The number of elements in the list. If the field value is a null string, @Elements(list) returns the number 0. @Count returns 1 if the field value is a null string or not a list value.

Usage

You can use @Elements in the condition statement of @For functions to set the loop count equal to the number of elements in the list:

@For(n := 1; n <= @Elements(list); n := n + 1;formula)

Examples

  1. This example returns 4 if the list in the SalesForce field is "Rogers":"Binney":"Harris":"Larson."
    @Elements(SalesForce)
  2. This example returns 2.
    @Elements("Jones":"Portsmore")
  3. This example returns 5.
    3 + @Elements("Liston":"Reed")
  4. This example, when added to the concat field, concatenates each element in the dogs field, containing, "Poodles":"Huskies":"Corgis" with each element in the love field, containing: "I love ":"I love ":"I love ":
    @For(n := 1;n <= @Elements(dogs); n := n+1;
    FIELD concat := @If(n = 1;love[n] + dogs[n];concat : (love[n] + dogs[n])));
    concat

    The result of this formula is: I love Poodles;I love Huskies;I love Corgis.