How to format a calculated number

I would like to perform 2 steps in one formula:

  1. calculate a number: {{ $json[“total_currency_balance”]*100/40}} returns 60.0
  2. format this number to currency format for Brazil: I normally use .toFixed(2).replace(“.” , “,”)

I tried to combine both but it returns an error “invalid syntax”:

Is there a way to do that does not involve creating another node?

Information on your n8n setup

  • n8n version: 1.45.1
  • Database (default: SQLite): sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: ubuntu

I think the parser got confused - adding some parenthesis will fix this:


1 Like

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