Is there a way to dynamically change the value of an expression widget?

In order to avoid cluttering the screen with Expression widgets for all possible situations, is it possible to have one that changes its value based on an if statement?


For example, if Client.Variable1 = 0 then show Client.Variable2 instead.

Hi Akis,

We can assign dynamic values to expression. For exact solution, please share in more details.

Thanks.

Solution

You can use if's in your expression like this:

if(client.variable1 = 0, client.variable2, client.variable1)

hope this helps

Solution

Orla Dijkink wrote:

You can use if's in your expression like this:

if(client.variable1 = 0, client.variable2, client.variable1)

hope this helps

Thanks to both, this is what I was looking for, turns out my syntax was just wrong.


You can do it like this:

(depending on the type of project, you may need to refresh the IFs and Expressions to show the newly calculated values)

- use an IF inside the expression


Or you can use an IF that has an expression in the True branch and a second expression in the False branch: