Display applications a Resource is used in

Hey @kdawgwilk-jasper!

At the moment that isn't a built-in feature though it has been requested a couple of times so you're definitely not alone in wanting it!

Both displaying all apps that use a particular resource and having an endpoint for listing existing apps are on the dev team's radar. They haven't been picked up as projects yet but if and when they are included we can report back here!

Unfortunately for Cloud users, you'll still need to manually export your apps individually from your Retool home page (as of version 2.107.1).

For folks using self-hosted Retool, the following query can be used to check the on-prem database for which apps use a particular resource. It can be good to save in your query library to make it easier to input the required variables:

with most_recent_saves as (
  select
  *
  from (
    select ps.*, row_number() over (partition by "pageId" order by "updatedAt" desc) as rs
    from page_saves ps
  ) ps_ranks
  where ps_ranks.rs = 1
),
resource as (
  select r.name as uuid from resources r
  left join resource_folders rf
    on r."resourceFolderId" = rf.id
  where r."displayName" = {{resource_display_name}}  -- plaintext name of the resource, must match exactly including whitespace
    and rf.name = {{resource_folder_name}}  -- plaintext name of the resource folder; if resource is not in a folder, use 'root'
),
pages_with_resource as (
  select *
  from
    most_recent_saves
  where
    cast(data as text) ilike (select concat('%', resource.uuid, '%') from resource)
)
select 
  concat(f.name, '/', p.name) as app_name
from pages_with_resource pwr
left join pages p 
  on pwr."pageId" = p.id
left join folders f
  on p."folderId" = f.id

**Note** It's not advised to make changes directly to your storage database as a lot of the values are interdependent, be super careful if you consider doing so!

1 Like