Checking Database for Entry and Compare to Another Database

Hi Wappler Community,

I am looking for help with this issue I have regarding checking database’s against each other and the correct way to return the data.

I have paged repeater working great displaying our products.

I have an add product to library button, which adds an entry to a separate table ‘Library Table’.

This ‘Library Table’ is setup to record line items of the ‘Product Id, Product Name and User Id’ so I can test this against the Actual Product Table.

However this is where I’m running into a problem, my paged repeater doesn’t let me access the Output Fields needed to condition the data against. Nested Repeat Regions

Essentially I want to get a true or false back from the database if the product id in the ‘Library Table’ equals the product id in ‘Actual Product Table’ - using the boolean to show or hide a button which lets them add the product to their library.

I have tried adding a repeater under the main repeater querying the database but it’s just looping through every product in the Library Table and returning the boolean (this will show a result for every item in the Library Table - not what I wanted). You can get an idea here with the buttons repeating and showing when it’s true and not true.

All of the tutorials seem to use a query value for ‘filtering’ the data in the database query. Is there a way to dynamically set the value of the filter for inside the repeater to check the database for the product id?

Thanks, I hope this kind of made sense.

Why not get all the data in a single query, use a LEFT JOIN to join with the Library Table.

https://www.w3schools.com/sql/sql_join_left.asp

You then just check if the UserId is not NULL to see if it is in the users library. No extra queries needed which would only make it slow.

1 Like

Hi @patrick ,

That worked a treat, thank you :smiley: