Check if an entry is referenced in another DB table

I have a list of texts coming from a Xano table called “parts”.

I’d like to change the styling of the texts if the “id” value of that “part” entry is to be found under the “part_id” column of another table called “progress” (that column is a “table reference” type, each value pointing to a specific entry of the “parts” table).

In other words, something like: if("id" is in "progress.part_id", true, false).

Is there a way to do this in Weweb without having to write custom code?
I’ve tried a few built-in functions such as “contains”, but without success.

Hey @unlustucru

I think you can use the lookup() function to do that
It will look something like: lookup(“id”, “progress”, “part_id”)
And if it returns an item then you return true

Hi @unlustucru

In my opinion it would be much better to do it on Xano backend using AddOn. Performing lookup on table/collection might slow down your frontend if there is a lot of items in both tables.

1 Like

That’s what I ended up doing.