Problem on linking databases

Hi everyone,
Glad to be part of the Bubble Community, may I ask your help:

We have two types of users (that we will call user A and user B) that work in different pages in the same app in this databases:

  • Users :
    email
    check_user (in order to check if the user is part of A’s category / yes.no field)
    Name(text)
    Username(text)

→ Invoice ( the users B creates a project that is assigned to the user A)
Customer_username ( User field - Category B users that means field check_user is no ; user that pays)
Recipient_username(User field - Category A users that means field check_user is yes; user that receives the payment )
id_invoice(text)

->Invoice_details(those are the bought items)
id_invoice_details (linked to id_invoice in Invoice )
Title(text)
Description(text)
Price(number)

So now we will analyze only the recipient dashboard . We have two pages : One with all the invoices in a repeating group and a button in every row that sends to a single invoice page with the id_invoice in url (that is an invoice field that as the same content as id_invoice_details) . In this single invoice page we have a list of all details of the customer (user B) and the recipient (user A). We have then a repeating group where all records with the id of the invoice (shown in url) should be listed. But we got an error (red text) when we try to recall back the id in the url doing a search for invoice_details with the constraint that id_invoice_details should be equal to id in url.

How can we solve that issue…

Thanks in advance for your help

It is difficult to understand the problem without some screenshots, but from what I can make out, I would design my database like this:

User (email, name, username, type). Type would be customer or seller.
Invoice (id, seller, customer, invoice_amount etc). Both seller and customer would be of type user
Invoice_detail (invoice, item_description, price, quantity etc)

Now, on the Seller’s dashboard, you can have a repeating group (RG) showing all invoices with constraint seller = current user (or current page user). When you click on a line in this RG, it should take you to the Invoice page/group with a content type of Invoice. It should also send the current cell’s Invoice to the group/page/

This Invoice page/group should have a RG with a data source of invoice_details with constraint of invoice = parent group/pages’ invoice.

In your RGs you should of course place whatever fields you want to display for the Invoice and Invoice_detail respectively.

I hope this helps. If not, you should probably share some screenshots to help people help you further.