Mobile Inventory Tutorial Error

The code given to query all data in the mobile inventory tutorial is giving me an error :

Relation "items" does not exist

for the sample code given in the documentation below. I can see that it says

from items and that it relates to nothing - but can someone help me understand how I can fix this error? What was the intent of the Retool code to include this?

-- sub-query to selects the data to use
with "itemsWithWH" as (
  select
    items.id,
    items.title,
    items."reviewsCount",
    items."thumbnailImage",
    items."price/value",
    items."price/currency",
    items."brand",
    items."url",
    items."returnPolicy",
    items."features/0",
    items."features/1",
    items."features/2",
    items."features/3",
 array_agg(distinct wh."warehouseId") as warehouses
  from items
  join "warehouseitems" as wh
  on wh."itemId" = items.id
  group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , 11, 12
)
select * from "itemsWithWH"
where
  title ilike {{ '%' + (Products_SearchInput.value || Filters_ProductSearchInput.value) + '%' }}
  and ({{ !Filters_BrandSelect.value }}
    or brand = {{ Filters_BrandSelect.value }})
  and ({{ !Filters_WarehouseSelect.value }}
    or {{ Filters_WarehouseSelect.value || 0 }} = any(warehouses))
  and ({{ !Products_Scanner.data }} or id = {{ Products_Scanner.data ? Products_Scanner.data[0] : 0 }})
order by "reviewsCount" desc

Hi @Lisa_Wright

Thanks so much for reporting this! I am reaching out to our team to update the docs

It looks like this query should work better:

with "itemsWithWH" as (
  select
    items.id,
    items.title,
    items."reviews_count",
    items."thumbnail_image",
    items."price_value",
    items."price_currency",
    items."brand",
    items."url",
    items."return_policy",
    items."features_0",
    items."features_1",
    items."features_2",
    items."features_3",
 array_agg(distinct wh."warehouse_id") as warehouses
  from inventory_management_items as items
  join "inventory_management_warehouseitems" as wh
  on wh.item_id = items.id
  group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 , 11, 12
)
select * from "itemsWithWH" where title ilike {{ '%' + (Products_SearchInput.value || Filters_ProductSearchInput.value) + '%' }}
  and ({{ !Filters_BrandSelect.value }}
    or brand = {{ Filters_BrandSelect.value }})
  and ({{ !Filters_WarehouseSelect.value }}
    or {{ Filters_WarehouseSelect.value || 0 }} = any(warehouses))
  and ({{ !Products_Scanner.data }} or id = {{ Products_Scanner.data ? Products_Scanner.data[0] : 0 }}) order by "reviews_count" desc