Creating An Algorithm

Hi All.

I was hoping that you all could help me with some feedback. I created an automation that takes a customer’s property search details from our CRM software and plugs it into a website. I want to take the automation further by creating an algorithm that changes the search depending on the property count after entering the customer’s search criteria.

So far I have created the following Scenario #1:

If (30)< PROPERTY COUNT > (80); then the search is complete! I use the following argument to see if a number falls between two numbers:

(${Low}<${Property_Count_Result} && ${Property_Count_Result}<${High})

{
  "Name": "Properties Found Count",
  "CreationDate": "2022-3-17",
  "Commands": [
    {
      "Command": "label",
      "Target": "RunPropertySearch",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "id=ctl00_NavigationPlaceHolder_barText",
      "Value": "Property_Count",
      "Description": "Save Property Count"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "var mystring = ${Property_Count}; var replaced = mystring.replace(/\\D/g, ''); return replaced",
      "Value": "Property_Count_Result",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "30",
      "Value": "Low",
      "Description": "Low Property Count"
    },
    {
      "Command": "store",
      "Target": "60",
      "Value": "High",
      "Description": "High Property Count"
    },
    {
      "Command": "if_v2",
      "Target": "(${Low}<${Property_Count_Result} && ${Property_Count_Result}<${High})",
      "Value": "",
      "Description": "Greater than \"LOW\" and Less than \"HIGH\""
    },
    {
      "Command": "click",
      "Target": "id=ctl00_NavigationPlaceHolder_selectAll",
      "Value": "",
      "Description": "Click Select All"
    },
    {
      "Command": "click",
      "Target": "xpath=//*[@id=\"ctl00_NavigationPlaceHolder_emailBtn\"]",
      "Value": "",
      "Description": "Email Properties"
    },
    {
      "Command": "waitForPageToLoad",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "BELOW 30 (LOW)",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "elseif",
      "Target": "${Property_Count_Result}<(${Low}) == true",
      "Value": "",
      "Description": "If Count is Less than \"LOW\""
    },
    {
      "Command": "clickAndWait",
      "Target": "id=ctl00_NavigationPlaceHolder_reviseBtn",
      "Value": "",
      "Description": "Click Revise"
    },
    {
      "Command": "type",
      "Target": "id=ctl00_ContentPlaceHolder_priceMax",
      "Value": "1500",
      "Description": "${Max_Price}+100"
    },
    {
      "Command": "click",
      "Target": "xpath=//input[@id='ctl00_NavigationPlaceHolder_searchBtn']",
      "Value": "",
      "Description": "Run Search"
    },
    {
      "Command": "waitForPageToLoad",
      "Target": "xpath=//input[@id='ctl00_NavigationPlaceHolder_searchBtn']",
      "Value": "",
      "Description": "Run Search"
    },
    {
      "Command": "gotoLabel",
      "Target": "RunPropertySearch",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "comment",
      "Target": "ABOVE 60 (HIGH)",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "elseif",
      "Target": "${Property_Count_Result}>=(${High}) == true",
      "Value": "",
      "Description": "If Count is More than \"HIGH\""
    },
    {
      "Command": "clickAndWait",
      "Target": "id=ctl00_NavigationPlaceHolder_reviseBtn",
      "Value": "",
      "Description": "Click Revise"
    },
    {
      "Command": "type",
      "Target": "xpath=//*[@id=\"ctl00_ContentPlaceHolder_yearBuiltMin\"]",
      "Value": "1990",
      "Description": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "xpath=//input[@id='ctl00_NavigationPlaceHolder_searchBtn']",
      "Value": "",
      "Description": "Run Search"
    },
    {
      "Command": "gotoLabel",
      "Target": "RunPropertySearch",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "else",
      "Target": "",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}```

Now, that I am able to determine if a number falls between two numbers I need for the Algorithm to have the following scenarios:

(Scenario # 2 = If a number is less than 30{Low})

Option A = increase budget by $100
> Then loop back to label = RunPropertySearch

**Question #1** = Let's say the results come back and its still low, how can I not run Option A again as listed above, however, run Option B as seen below? 

Option B = in crease mileage on radius search by 5 miles!
> Then loop back to label = RunPropertySearch

Option C = echo, manually adjust the search

(Scenario # 3 = If a number is greater than 60{High})

Option A = decrease mileage on radius search by 5 miles!
> Then loop back to label = RunPropertySearch

Option B = add minimum year built 1990
> Then loop back to label = RunPropertySearch