RepeatingElement

RepeatingElement[spec]

represents an arbitrarily repeated type of element in an interpreter, API or form specification.

RepeatingElement[spec,max]

represents an element that can appear at most max times.

RepeatingElement[spec,{min,max}]

represents an element that can appear between min and max times.

RepeatingElement[spec,{n,{min,max}}]

represents an element that initially appears n times in a form.

RepeatingElement[spec,{{i,n},{min,max}}]

represents an element where i takes successive values.

Details

Examples

open allclose all

Basic Examples  (5)

RepeatingElement can be used in FormFunction to repeat a field:

RepeatingElement fields can also be filled programmatically:

In an APIFunction, RepeatingElement specifies that all instances of a particular parameter should be used:

Without RepeatingElement, only the last instance is used:

Interpreter threads over lists, so RepeatingElement is not needed here:

This interprets lists containing a single integer and a repeating list of integers:

RepeatingElement can be used to limit the number of elements:

Scope  (3)

Use the second argument to limit the number of elements:

Use the second argument to set the initial number of fields to be displayed:

Use the second argument to change the label of the fields:

Properties & Relations  (4)

Use RepeatingElement in conjunction with CompoundElement to interpret complicated structures:

Use it in conjunction with Alternatives to interpret data that can have different shapes:

RepeatingElement should not be confused with DelimitedSequence. RepeatingElement does not permit a single string separated by delimiters:

Use DelimitedSequence for elements separated by delimiters:

Use with CompoundElement in the context of FormFunction to generate a table of fields:

Possible Issues  (1)

When using the second argument of RepeatingElement with an index in the context of a web form or an API, the "Interpreter" field cannot depend on the index:

This is due to the fact that the "Interpreter" field cannot be delayed:

Introduced in 2015
 (10.1)