Problem with gotoIf command if the value is more than 5 digit (Specifically b/w 100000-199999)

I am trying to create a loop with gotoif command, there seems to be some problem if the value of A is between 100000 to 199999. could someone help me understand the problem with the below loop

{
  "Name": "Test",
  "CreationDate": "2024-7-26",
  "Commands": [
    {
      "Command": "label",
      "Target": "Start",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "104000",
      "Value": "A",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "80000",
      "Value": "B",
      "Description": ""
    },
    {
      "Command": "executeScript",
      "Target": "return Number (Number (${A})*0.75) .toFixed(2)",
      "Value": "B",
      "Description": ""
    },   
  {
      "Command": "gotoIf",
      "Target": "${A} > ${B}",
      "Value": "Start",
      "Description": ""
    },

You are comparing strings, that is why 78000 “wins” against 104000 :wink:

=> The solution is to use “ParseInt” before comparing the values.

In the screenshot, note that variables that have a string as content have the "" quotation marks (here: variables A and B) and variables with numbers do not have "" (here: C_is_number).

{
  "Name": "compare_numbers",
  "CreationDate": "2024-7-31",
  "Commands": [
    {
      "Command": "label",
      "Target": "Start",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "104000",
      "Value": "A",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "80000",
      "Value": "B",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return Number (Number (${A})*0.75) .toFixed(2)",
      "Value": "B",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "return parseInt((Number (${A})*0.75) .toFixed(2))",
      "Value": "C_is_Number",
      "Description": ""
    },
    {
      "Command": "if",
      "Target": "parseInt(${A}) > parseInt(${B})",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "A is larger than B!",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "else",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "B wins",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

Similar String to Integer conversion posts:

Perfect! I didn’t realize that I am comparing strings.

Thank you :pray: