How can I round up and round down to the nearest 100 from a stored value?

Hi, any ideas on a script to change a stored numerical value to the closet 100? i.e. If I’ve got 62,156 be able to store 62,200?

Rounding to nearest 100:

executeScript_Sandbox | return 100 * Math.ceil(${raw}/ 100); | result

See also generate random number

Macro:

    {
      "Name": "rounding",
      "CreationDate": "2021-10-13",
      "Commands": [
        {
          "Command": "store",
          "Target": "61234",
          "Value": "raw",
          "Description": ""
        },
        {
          "Command": "executeScript_Sandbox",
          "Target": "return 100 * Math.ceil(${raw}/ 100);",
          "Value": "rounded",
          "Description": ""
        },
        {
          "Command": "echo",
          "Target": "${rounded}",
          "Value": "green",
          "Description": ""
        }
      ]
    }
2 Likes