Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
calculate_lookup_table_values [2025/12/22 15:51]
admin created
calculate_lookup_table_values [2026/08/28 03:14] (current)
hermann Sync from local documentation review
Line 3: Line 3:
 ===== Description ===== ===== Description =====
  
-This functor generates ​a new lookup table using keys from base table and calculating ​values ​from a specified ​expression ​that can reference other tables and values.+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 unchanged ​from the base table; only the values ​are computed by the expression
 + 
 +This is one of Dinamica EGO's five calculator functors. Use it to recompute the values ​of an existing lookup table row by row while keeping the same key structure; use [[Calculate Lookup Table Keys And Values]] instead when the keys also need to be recomputed. Its abbreviated (shorthand) syntax is ''​%''​. See [[ego_script#​calculator_functor_shorthand|Calculator functor shorthand]] in the EGO Script documentation for the verbose and abbreviated forms, and [[Calculate Functors|Calculate Functors — Complete Operator Documentation]] for the full expression language reference.
  
 ===== Inputs ===== ===== Inputs =====
  
 ^ Name  ^ Type  ^ Description ​ ^ ^ Name  ^ Type  ^ Description ​ ^
-| Value Column Expression | [[Image Expression Type]] ​ | Expression ​describing how each new value should ​be calculated.  |+| Value Column Expression ​ | [[Image Expression Type]] ​ | Expression ​evaluated once per row of Base Lookup Table; its result becomes that row'​s ​value in the output table. Must be enclosed in square brackets ''​[ ]''​ in EGO Script.  |
  
 ===== Optional Inputs ===== ===== Optional Inputs =====
  
 ^ Name  ^ Type  ^ Description ​ ^ Default Value  ^ ^ Name  ^ Type  ^ Description ​ ^ Default Value  ^
-| Key Column Name  | [[Name Type]] ​ | Name of the key column. If omitted, the corresponding name from the table used as format ​will be used.  | None  | +| Key Column Name  | [[Name Type]] ​ | Name of the key column ​in the resulting lookup table. If omitted, the corresponding name from the table used as format ​is used.  | .none  | 
-| Value Column Name  | [[Name Type]] ​ | Name of the value column. If omitted, the corresponding name from the table used as format ​will be used.  | None  | +| Value Column Name  | [[Name Type]] ​ | Name of the value column ​in the resulting lookup table. If omitted, the corresponding name from the table used as format ​is used.  | .none  | 
-| Base Lookup Table  | [[Lookup Table Type]] ​ | Lookup table that, if provided, ​determines for which entries ​the value generation expression will be called. If this table is not provided, the table in the list of input tables ​with the smallest identifier value will be used.  | None  |+| Base Lookup Table  | [[Lookup Table Type]] ​ | 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 (rather than a regular table) ​is used as the row source in the verbose formor the first lookup ​table referenced by name in the expression in the 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 the abbreviated syntax available.  | .none  |
  
-===== Output ​=====+===== Outputs ​=====
  
 ^ Name  ^ Type  ^ Description ​ ^ ^ Name  ^ Type  ^ Description ​ ^
-| Result ​ | [[Lookup Table Type]] ​ | Lookup table calculated ​from the input tables ​and values. ​ |+| Result ​ | [[Lookup Table Type]] ​ | Lookup table with keys from Base Lookup Table and values ​computed by Value Column Expression.  |
  
 ===== Group ===== ===== Group =====
  
-[[Functor List#Table | Table]]+[[Functor List#Lookup ​Table | Lookup ​Table]]
  
 ===== Notes ===== ===== Notes =====
  
-For each key present ​in the base lookup ​tablea key-value pair will be created ​and inserted into the resulting ​table. ​Keys are preserved from the base table, ​while values ​are calculated ​using the provided expression. The values of the key and value columns ​from the table used as format will be accessible during calculation as "​line" ​and "​column"​respectively, in the expressions ​for calculating values of the resulting lookup table.+==== 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 t1t2, …, 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 columnand 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 operatorsscalar 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 ===== ===== Internal Name =====