# Trouble sorting based on db value

**URL:** <https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676>\
**Category:** Get Help\
**Created:** [August 30, 2020, 10:35pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676 "2020-08-30T22:35:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/rjp/32/571_2.png) [@rjp](https://forum.adalo.com/u/rjp)\
**Post date:** [August 30, 2020, 10:35pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/1 "2020-08-30T22:35:52Z")

</div>

I have a table for the company and in that table, I have a relationship to another table for work trades

I have an appointment builder and want to show all company and all work that are compatible.

when i go to the db i can see each company and the work they do, but when i try to filter its not an option?

I need to have trades visible?

So it will show all jobs available to the selected company. what am i missing?

 ![Screen Shot 2020-08-30 at 6.33.45 PM](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/9/95ff37ea14d3990aafec0d488c46bbc4968e7e94.png)

---

<div class="post-metadata">

**Author:** ![rjp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/rjp/32/571_2.png) [@rjp](https://forum.adalo.com/u/rjp)\
**Post date:** [August 31, 2020, 12:02pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/2 "2020-08-31T12:02:38Z")

</div>

Any idea what im doing wrong? seams like i should have access to all records in a db table even the relational ones?

---

<div class="post-metadata">

**Author:** ![anon78309838](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@anon78309838](https://forum.adalo.com/u/anon78309838)\
**Post date:** [August 31, 2020, 3:01pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/3 "2020-08-31T15:01:39Z")

</div>

What kind of a relationship is it?

---

<div class="post-metadata">

**Author:** ![rjp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/rjp/32/571_2.png) [@rjp](https://forum.adalo.com/u/rjp)\
**Post date:** [August 31, 2020, 6:29pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/4 "2020-08-31T18:29:56Z")

</div>

The relationship with company and trade is a m2m

---

<div class="post-metadata">

**Author:** ![rjp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/rjp/32/571_2.png) [@rjp](https://forum.adalo.com/u/rjp)\
**Post date:** [September 1, 2020, 11:40am UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/5 "2020-09-01T11:40:38Z")

</div>

Any idea? why can i not acces that information?

---

<div class="post-metadata">

**Author:** ![anon78309838](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@anon78309838](https://forum.adalo.com/u/anon78309838)\
**Post date:** [September 1, 2020, 1:10pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/6 "2020-09-01T13:10:15Z")

</div>

I have a hunch it’s because the relationship is not right but I will have to investigate further when I get a chance. I will get back to you with some answers as soon as I can 🙂

---

<div class="post-metadata">

**Author:** ![vancewong](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vancewong](https://forum.adalo.com/u/vancewong)\
**Post date:** [September 1, 2020, 3:19pm UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/7 "2020-09-01T15:19:35Z")

</div>

Hey @rjp, tbh your setup of the data tables is quite confusing… But this is how I envision you can possbily implement your idea.

Correct me if I’m wrong, but the top level is a list of companies that you want clients (logged in users) to see.

So the first thing the user sees should be a list of companies.

When they tap into a company, they should see the work items and trades available (looks like 2 separate data collections) for ordering from that specific company.

You’ll need to create a 1-to-many relationships (company to many work items, company to many trades).

Beside each work item or trade, you can add a “BOOK” or “ORDER” button, which leads to a form. The form will have pre-filled details of the specific work item or trade that the user selected. For eg. notes, company name, price, etc.

The user will then have to key in their name, address, phone, email, and contact so that the company he/she wants to hire can contact them back.

Upon submission of the form, you can either create an order (which requires another data collection, 1 to many relationship again: 1 work item or trade to many orders) in a separate data collection that the companies can then access via the app, or you can send an email (requires custom action available only on the paid plan) using Sendinblue or SendGrid.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![anon78309838](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@anon78309838](https://forum.adalo.com/u/anon78309838)\
**Post date:** [September 2, 2020, 8:49am UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/8 "2020-09-02T08:49:23Z")

</div>

Thanks for helping out with that @vancewong!

@rjp Does this solve the problem? If not, let us know so we can help further!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/system/32/40401_2.png) [@system](https://forum.adalo.com/u/system)\
**Post date:** [September 12, 2020, 8:49am UTC](https://forum.adalo.com/t/trouble-sorting-based-on-db-value/3676/9 "2020-09-12T08:49:34Z")

</div>

Closed on September 12, 2020, 8:49am UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
