| |
syntax:generate [2025/06/24 00:38] – created dmitry | syntax:generate [2025/06/28 23:27] (current) – dmitry |
---|
When editing an expression, switch to the "Generate" mode of the Expression Editor. Enter a description in plain English of what the desired expression should do, and press the "Generate" button. | When editing an expression, switch to the "Generate" mode of the Expression Editor. Enter a description in plain English of what the desired expression should do, and press the "Generate" button. |
| |
When describing your desired expression, be specific about the calculation logic rather than the outcome. Instead of entering "calculate the profit", outline the exact calculation method: "multiply revenue by quantity, then subtract costs". | When describing your desired expression, be specific about the calculation logic rather than the outcome. Instead of entering "calculate the profit", outline the exact calculation method: "multiply price by quantity, then subtract costs". |
| |
To be more specific, use in your description the names of available columns and parameters. You can click them in the Expression Editor to insert them in the description, instead of typing in manually. Clearly state how different fields should be combined mathematically or logically. | To be more specific, use in your description the names of available columns and parameters explicitly, as they might be hard to guess otherwise. You can click column and parameter names in the left pane of the Expression Editor to insert them in the description, instead of typing them in manually. Clearly state how different fields should be combined mathematically or logically. |
| |
Generating expressions from a description usually works well with mathematical calculations, text manipulations, date operations, and conditional logic using IF statements. However, it's not possible to create expressions for calculations that are beyond what can be done with expressions in EasyMorph. For instance, expressions can't involve multiple rows (such as calculations with the previous row), do complex aggregations, or generate files, or connect to external services. You may need to use [[transformations:start|actions]] for that, instead of expressions. | Generating expressions from a description usually works well with mathematical calculations, text manipulations, date operations, and conditional logic using IF statements. However, it's not possible to create expressions for calculations that are beyond what can be done with expressions in EasyMorph in principle. For instance, expressions can't involve multiple rows (such as calculations with the previous row), or do aggregations, or generate files, or connect to external services. You may need to use [[transformations:start|actions]] for that, instead of expressions. |
| |
Also, expressions can't use functions other than [[syntax:functions|those available in EasyMorph]]. | Also, expressions can't use functions other than [[syntax:functions|those available in EasyMorph]]. |
Keep your descriptions concise yet complete. Mention specific columns by name when possible, and describe any conditional logic step-by-step. For example: "If the [Status] column equals 'Active' and [Days Since Purchase] is greater than 30, multiply [Price] by [Discount Rate]; otherwise, return the [Original Price]". | Keep your descriptions concise yet complete. Mention specific columns by name when possible, and describe any conditional logic step-by-step. For example: "If the [Status] column equals 'Active' and [Days Since Purchase] is greater than 30, multiply [Price] by [Discount Rate]; otherwise, return the [Original Price]". |
| |
Finally, keep in mind that expressions are used to calculate one result per row. For instance, it's not possible to create one expression that calculates or modifies two or more columns at once. If that is necessary, use multiple expressions in multiple actions to perform the necessary calculations one by one. | Finally, keep in mind that expressions are used to calculate one and only one result per each row in the table. For instance, it's not possible to create one expression that calculates or modifies two or more columns at once. If that is necessary, use multiple expressions in multiple actions to perform the necessary calculations one by one. |