====== Calculate Lookup Table Values ====== ===== Description ===== Generates a new lookup table by evaluating an expression **once per row** of a base lookup table. The keys of the output table are inherited from the base table; the values are computed by the expression. This functor is one of five in the [[calculate_functors|calculator family]]. Use it when you need to recompute the values of an existing lookup table row by row, keeping the same key structure. If you also need to recompute the keys, use [[Calculate Lookup Table Keys And Values]] instead. The **abbreviated syntax** (also called **shorthand**) for this functor is ''%''. See [[ego_script#calculator_functor_shorthand|Calculator functor shorthand]] in the EGO Script documentation for the full syntax of both the verbose and abbreviated forms, and [[calculate_functors|Calculate Functors — Complete Operator Documentation]] for the complete expression language reference. ===== Inputs ===== ^ Name ^ Type ^ Description ^ | Value Column Expression | [[Image Expression Type]] | The formula evaluated for each row. The result becomes the value for that row's key in the output table. Must be enclosed in square brackets ''[ ]'' in EGO Script. | ===== Optional Inputs ===== ^ Name ^ Type ^ Default ^ Description ^ | Key Column Name | [[Name Type]] | None | Name of the key column in the output lookup table. If omitted, the corresponding name from the base table is used. | | Value Column Name | [[Name Type]] | None | Name of the value column in the output lookup table. If omitted, the corresponding name from the base table is used. | | Base Lookup Table | [[Lookup Table Type]] | None | The lookup table whose key set drives iteration. When not provided, the [[Number Table]] hook with the lowest list index that is connected to a **lookup table** (not a regular table) is used as the row source (verbose form), or the first lookup table referenced by name in the expression (abbreviated form) — not a union of all connected tables. Prefer this port over a ''Number Table'' hook when the table is needed only to define the row set and is not referenced in the expression, to keep abbreviated syntax available. | ===== Output ===== ^ Name ^ Type ^ Description ^ | Result | [[Lookup Table Type]] | A lookup table with keys from the base table and values computed by the expression. | ===== Group ===== [[Functor List#Table | Table]] ===== Notes ===== ==== Connecting data inputs ==== Tables, lookup tables, and scalar values referenced in the expression must be connected to the functor's ports before writing the expression, using **hook** functors: * Tables and lookup tables → [[Number Table]] → referenced in the expression as ''t1'', ''t2'', …, ''t100'' * Scalar values → [[Number Value]] → referenced as ''v1'', ''v2'', …, ''v100'' Maps cannot be connected — there is no cell context in this functor. In the abbreviated syntax, tables are referenced as ''%variableName'' and values as ''$variableName''. ==== Row iteration context ==== The expression is evaluated once per row of the base lookup table. Two keywords reflect the current row inside the expression: * ''line'' — the **key** of the current row * ''column'' — the **value already associated with that key** in the base lookup table This allows the expression to read the row's existing value directly via ''column'', and to look up related values from other connected tables using the current row's key — for example, ''t1[line]'' retrieves the value from table ''t1'' whose key matches the current row. ==== Available expression features ==== Image operators (''iX''), neighbourhood functions, neighbourhood indexing, and convolution are not available — there is no spatial grid. Available features are arithmetic and logical operators, scalar references (''vX''), table and lookup table queries (''tX[...]'') in all single-key and multi-column forms, and the ''line'' and ''column'' row-context keywords. See [[calculate_functors#the_expression_language|The Expression Language]] for the complete reference, or [[Image Expression Type]] for the navigable operator index. ==== Null value handling ==== Null propagation rules and defensive patterns are covered in [[calculate_functors#null_value_handling|Null Value Handling]] in the Calculate Functors documentation. ===== Internal Name ===== ''CalculateLookupTableValues''