# Problem on linking databases

**URL:** <https://forum.bubble.io/t/problem-on-linking-databases/10310>\
**Category:** Database\
**Created:** [February 7, 2017, 8:25pm UTC](https://forum.bubble.io/t/problem-on-linking-databases/10310 "2017-02-07T20:25:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lam](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/lam/32/14554_2.png) [@lam](https://forum.bubble.io/u/lam)\
**Post date:** [February 7, 2017, 8:25pm UTC](https://forum.bubble.io/t/problem-on-linking-databases/10310/1 "2017-02-07T20:25:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![louisadekoya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/louisadekoya/32/217422_2.png) [@louisadekoya](https://forum.bubble.io/u/louisadekoya)\
**Post date:** [February 7, 2017, 10:48pm UTC](https://forum.bubble.io/t/problem-on-linking-databases/10310/2 "2017-02-07T22:48:24Z")

</div>

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.
