Was this page helpful?

List.Reduce

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    List.Reduce(list : list, expression : str, value : any) : any

    Combine all values in list into a single value using the supplied expression.

    Usage Restrictions

    9.02 or later.

    Parameters

    Name Type Description
    list list list value
    expression str expression to compute combined value (use '$value' and '$item' to refer to the current value and item, respectively)
    value any? starting value (optional, default: nil)

    Result

    A single value representing the combination of lists values using the supplied expression

    Samples

       Output

    Concatenate all list items with a ":" separator:

    {{list.reduce(["a","b","c"],"$value .. ':' .. $item ")}}  

    :a:b:c

    Concatenate all list items with a leading string:

    {{list.reduce(["middle","end"],"$value .. '-' .. $item ", "start")}} 

    start-middle-end

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by