You may use GraphQL variables if you need data from a list of values for one or more attributes. Let's say you need to retrieve data with Brand A as well as Brand B. To accomplish this type of search, you'll want to loop through multiple calls to account for each value combination. Variables allow you to keep the query constant in each call and only change the variable inputs.

If you have a list of Regions and a list of NAICS Codes in those Regions to search, you may pass variables for Region and NAICS code in the query. You only need to change the Query Variables each time to cover the full list of value combinations.

query SearchByRegionAndNaics($region: String!, $naics: Int!) {
  search(filter: { 
    naics_code: $naics, 
    address: { 
        region: $region 
    } 
  }) {
    places {
      results {
        edges {
          node {
            placekey
            safegraph_core {
              location_name
              street_address
              top_category
              sub_category
              naics_code
            }
          }
        }
      }  
    }
  }
}
{
  "region": "IL",
  "naics": 445291
}
{
  "data": {
    "search": {
      "places": {
        "results": {
          "edges": [
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "444 Chicago Ridge Mall Dr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "1503 N Aurora Rd",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Daylight Donuts",
                  "street_address": "1965 Madison Ave",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "1650 Premium Outlet Blvd",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "7501 W Cermak Rd",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "1700 N State St",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Pretzelmaker",
                  "street_address": "1615 E Empire St",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "4999 Old Orchard Ctr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Daylight Donuts",
                  "street_address": "207 N Keller Dr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "412 Orland Square Dr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Daylight Donuts",
                  "street_address": "320 W Main St",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "1905 N Francisco Ave",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "7200 Harrison Ave",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "3340 Mall Loop Dr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "30 Oakbrook Ctr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "1166 E State St",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "3100 S Cicero Ave",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "149 E Ogden Ave",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "121 Yorktown Shopping Ctr",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "25W 420 Geneva Rd",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            },
            {
              "node": {
                "placekey": "[email protected]",
                "safegraph_core": {
                  "location_name": "Mrs. Fields Gifts",
                  "street_address": "1400 W Algonquin Rd",
                  "top_category": "Specialty Food Stores",
                  "sub_category": "Baked Goods Stores",
                  "naics_code": 445291
                }
              }
            }
          ]
        }
      }
    }
  },
  "extensions": {
    "row_count": 21,
    "version_date": [
      "safegraph_core: 1645948803__2022_02",
      "safegraph_geometry: 1645948803__2022_02",
      "safegraph_weekly_patterns2: 2022_01_11",
      "safegraph_monthly_patterns: 2022_01_11"
    ]
  }
}