Skip to content

Main content

Exclusive Choice Cardinality Tool

Calculate exclusive choice cardinality from explicit caller-supplied inputs.

Loading tool…

Description

Count true entries in selected and return valid when selectedCount equals nonnegative integer requiredExactly.

Identifier validation can involve several distinct questions: whether text has the expected shape, whether a checksum is consistent, and whether an authority actually assigned the identifier. Formatting and field extraction address narrower questions. Each result must be read according to the particular property the tool checks.

Count true entries in selected and return valid when selectedCount equals nonnegative integer requiredExactly.

When to use this tool

Use Exclusive Choice Cardinality when you need the particular shape, formatting, field, or checksum property as one explicit stage in an identifier workflow.

How to use the tool and how it works

  1. Enter selected, requiredExactly. Keep parallel arrays aligned. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read selectedCount, valid. Inspect valid before interpreting the associated values.

Count true entries in selected and return valid when selectedCount equals nonnegative integer requiredExactly.1

Input fieldMeaning and unitsAccepted input
selectedSelectedRequired. Array of Boolean.; maximum items 256.
requiredExactlyRequired ExactlyRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
selectedCountSelected CountRequired. Safe integer.
validWhether this tool’s particular check passes; does not imply broader identifier or protocol validity.Required. Boolean.
json
{
  "input": {
    "selected": [
      true,
      false,
      true
    ],
    "requiredExactly": 1
  },
  "output": {
    "selectedCount": 2,
    "valid": false
  }
}

Limitations and assumptions

  • RequiredExactly may exceed list length and simply yield false. This checks supplied boolean cardinality, not mutual exclusivity of semantic choices or the validity of selected values.
  • The field tables state structural bounds; the mechanics also specify cross-field constraints. Malformed inputs and unsupported domains cause errors. A successful false flag, empty branch value, or zero placeholder has the meaning stated above and is distinct from an input error.

Alternative or Complementary methods

Use a complete format and checksum validator when required, then consult the issuing registry or verification process for assignment and identity. Preserve meaningful leading zeros as text.

References

  1. Calculation and input contract: validate/exclusive-choice-cardinality — tool.io

Similar or alternative tools