Record First Match Lookup
Find the first exact typed-scalar own-key match; return explicit null when no record matches.
Description
Find the first exact typed-scalar own-key match; return explicit null when no record matches.
A first-match lookup retrieves one record from an ordered collection. Its result must distinguish a missing match from a matching record that contains null values.
When to use this tool
Find the first exact typed-scalar own-key match; return explicit null when no record matches.
- Prepare the supplied recordsJson, keyField, queryJson fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter recordsJson, keyField, queryJson. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.found, result.recordIndex, result.record. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Parse queryJson as a scalar key, scan records in order for an own keyField with the same typed serialized key, and return found, the first index and that record. Return null index/record when absent.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| recordsJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
| keyField | key field. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| queryJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.
[
{
"field": "recordsJson",
"decoded": [
{
"id": 1
},
{
"id": 1
}
]
},
{
"field": "queryJson",
"decoded": 1
}
] | Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.found | Flag for found under the exact condition described above. |
| result.recordIndex | The record index value under the stated formula or text convention. |
| result.record | The record value under the stated formula or text convention. |
{
"input": {
"recordsJson": "[{\"id\":1},{\"id\":1}]",
"keyField": "id",
"queryJson": "1"
},
"output": {
"result": {
"found": true,
"recordIndex": 0,
"record": {
"id": 1
}
}
}
} Limitations and assumptions
- Only the first match is returned. Missing key properties never match; containers cannot be comparison keys, and the tool does not enforce uniqueness.
- Decoded JSON is bounded to 20,000 nodes and 32 nesting levels; record arrays have at most 128 records. Parsed number values use JavaScript floating point rather than arbitrary-precision decimal arithmetic.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
For document-wide requirements, combine these structural inventories with an explicit JSON Schema. Preserve the distinction between missing properties and null values, and between numbers and numeric-looking strings when building joins or indexes.
References
Similar or alternative tools
- Record Array Unique Key Indexer
Build a unique typed-scalar record index as entries; numeric and string keys remain distinct, missing and duplicate keys fail.
- Record Equijoin Cardinality Counter
Count exact typed-scalar equijoin pairs with full duplicate multiplicity; absent members do not join, explicit null values can join.