Forum Discussion

lazzarjovvch74's avatar
6 years ago
Solved

Search tables with multiple values

Hi,

 

I have two tables where some of the columns contain multiple values. This is the example of 2 tables:

Table 1 (Contacts)

IDNameTerritory InterestProduct TypeInvest
1DianaLocation 1, Location 2, Location 3Type1, Type210000
2BradLocation 1Type 12000
3NagelAllType 220000
4HaroldAllType1, Type24000
6BradLocation 2Type1, Type210000
7DrorAllType 38000
8HaroldLocation 3, Location 4Type1, Type2, Type315000
9StevenLocation 3Type 210000
10BradLocation 4Type32500

 

Table 2 (Products)

Product IDProduct LineProduct TypeLocationsBudget
1Product Line 1Type1Location 2$10,000
2Product Line 2Type2Location 4$15,000
3Product Line 3Type2Location 3$12,500
4Product Line 4Type1, Type2Location 3$8,000
5Product Line 5Type3Location 1$4,000

 

I want to create drop-down filters "Product Type" and "Locations" with unique values from these columns and when a user selects "Type2" (for an example), both tables should list records that contain "Type2" in the column "Product Type". I want to do the same with a selection based on the column "Location".

 

Thank you in advance!

 

 

  • Hi. In ordert o get this you should duplicate some rows to expand those values. Go to edit queries. Right click on the column with commas, then split column -> by delimiter. Then open the advanced options and check for "Rows", remove the quotes and click accept. That will create a unique value for the column type for example.

     

    The problem with this is that you will have problem with relationships if you do that for product because you are going to have duplicated ids. Then you may want to create a new combined column to have as the key unique column of the table; like product_id + type.

     

    Hope this helps,

    Regards,

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Hi. In ordert o get this you should duplicate some rows to expand those values. Go to edit queries. Right click on the column with commas, then split column -> by delimiter. Then open the advanced options and check for "Rows", remove the quotes and click accept. That will create a unique value for the column type for example.

     

    The problem with this is that you will have problem with relationships if you do that for product because you are going to have duplicated ids. Then you may want to create a new combined column to have as the key unique column of the table; like product_id + type.

     

    Hope this helps,

    Regards,

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.