AnySubset

AnySubset[{c1,c2,}]

represents an element in an interpreter or form that accepts any subset of the choices ci.

AnySubset[{lab1c1,lab2c2,}]

accepts any subset of the labi, yielding the corresponding ci as results.

AnySubset[EntityClass["type","class"]]

accepts any subset of the entities in the specified entity class.

AnySubset[choices,max]

allows at most max choices to be selected.

AnySubset[choices,{min,max}]

allows at least min and at most max choices to be selected.

Details

  • Interpreter[AnySubset[{c1,c2,}]][{i1,i2,}] yields a list of those ck that appear among the ik.
  • In a form, AnySubset can be represented by CheckboxBar, TogglerBar, or ListPicker.
  • When the input does not match the interpreter specification, Interpreter[AnySubset[]][input] gives a Failure object.
  • In the form AnySubset[{lab1c1,lab2c2,}], the ci might contain duplicates. If that is the case, and multiple labj corresponding to the same ci are given, only one ci will be returned.

Examples

open allclose all

Basic Examples  (2)

Use AnySubset to specify a form field where more than one choice can be selected at the same time:

Use AnySubset in Interpreter to validate lists of inputs:

Scope  (4)

Interpreter will return a Failure object if the list of inputs is incompatible with the choices:

Specify a minimum and maximum number of choices:

AnySubset can be used in FormFunction to generate an appropriate controller:

Specify a TogglerBar:

Specify a ListPicker:

Possible Issues  (2)

Sometimes the list of values can contain duplicates. If that happens, only one occurrence will be returned:

Different labels can be given for the same value; however, they will always be selected together:

Wolfram Research (2015), AnySubset, Wolfram Language function, https://reference.wolfram.com/language/ref/AnySubset.html.

Text

Wolfram Research (2015), AnySubset, Wolfram Language function, https://reference.wolfram.com/language/ref/AnySubset.html.

CMS

Wolfram Language. 2015. "AnySubset." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AnySubset.html.

APA

Wolfram Language. (2015). AnySubset. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AnySubset.html

BibTeX

@misc{reference.wolfram_2022_anysubset, author="Wolfram Research", title="{AnySubset}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/AnySubset.html}", note=[Accessed: 05-December-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_anysubset, organization={Wolfram Research}, title={AnySubset}, year={2015}, url={https://reference.wolfram.com/language/ref/AnySubset.html}, note=[Accessed: 05-December-2022 ]}