Formula in expression (mathematics)

In a change node (see flow) I need to use the formula below:

value = 10 ^ ((x-109) / 32)

but I have no idea what is the correct way to put this formula in there. Of course I have tried different ways but without success. Could someone help me?

[{"id":"c559743c.82b088","type":"tab","label":"Formula","disabled":false,"info":""},{"id":"197314e1.24d27b","type":"debug","z":"c559743c.82b088","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":530,"y":160,"wires":[]},{"id":"75cea3ad.e7730c","type":"inject","z":"c559743c.82b088","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"80","payloadType":"num","x":130,"y":100,"wires":[["e4aa1f6.b0285e"]]},{"id":"e4aa1f6.b0285e","type":"change","z":"c559743c.82b088","name":"Change to Value","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t\"Value\": payload * 1\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":160,"wires":[["197314e1.24d27b"]]},{"id":"ae6e09de.575678","type":"inject","z":"c559743c.82b088","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"230","payloadType":"num","x":130,"y":220,"wires":[["e4aa1f6.b0285e"]]},{"id":"f2e12f3e.f44ab","type":"inject","z":"c559743c.82b088","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"150","payloadType":"num","x":130,"y":160,"wires":[["e4aa1f6.b0285e"]]}]

The JSONata expression for that equation is:

$power(10, (payload-109)/32)
2 Likes

Thanks Nick for this useful info, it works!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.