You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/01/20 15:21:00 UTC

[jira] [Created] (CAMEL-22882) camel-core - Local assignment for temporary variables in simple expressions

Claus Ibsen created CAMEL-22882:
-----------------------------------

             Summary: camel-core - Local assignment for temporary variables in simple expressions
                 Key: CAMEL-22882
                 URL: https://issues.apache.org/jira/browse/CAMEL-22882
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: Claus Ibsen


If you use simple for mapping or something a little bit more complex, then you may want to be able to assign local temporary variables with calculations or other expressions to make it easier to build up the result.
{code:java}
${localVariables(
  $foo = ${sum(1,2,3)}
  $len = ${body.length}
  $zip = ${body.zip.code}
  $priority = $foo > 999 ? true : false
)}
id: ${body.id}
postal: ${variable.zip}
quick: ${priority} ? 'high' : 'normal'{code}
So if we can make $\{localVariable(..) some kind of pre calculations that has no affect on the result of the expression and that it does not add up as empty lines etc.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)