#1
I have a list of locations in a table that includes an event_id.

I created a many-to-many relationship for members and locations.

When I edit a member record and click on ASSOCIATE WITH LOCATION, I don't want every location to appear in the select dropdown.

I only want specific locations to appear that are filtered by the event_id.

How can I filter locations where event_id = 3 (for example) are displayed in the drop-down when I use the Associate With Location pop-up modal?
#2
Hello,
I only want specific locations to appear that are filtered by the event_id.

How can I filter locations where event_id = 3 (for example) are displayed in the drop-down when I use the Associate With Location pop-up modal?

First, query the database using a Get Where (event_id = 3).
Then populate the drop down with the result.

Dan
#3
Thanks Dan.

I always avoid changing core functionality since it can be overwritten.

However, after review, I realize that module_relations can be changed once written since it won't be overwritten on future updates.

Regardless, using the following code requires that I have an event_id column on all my many_to_many table relationships so that won't work either:

#4
Hello,
You could filter by postal code using radius.

See this article.
https://community.powerbi.com/t5/Desktop/Filtering-postal-codes-and-their-related-marketing-data-by/td-p/1130421
#5
Very fancy Dan, I like it :)

mjim, to filter locations by event_id, you need to create a bridging table that stores the associated entities between members and locations. Then you need to create one-to-many relationships between the three tables. You can use the $this->model->get_where_custom() method to query the bridging table with a specific event_id and get the corresponding location_ids. Then you can use those location_ids to filter the locations in the select dropdown.
#6
Hey Dan, that’s not what I’m looking for here, but I can definitely use that for another project. Thank you for sharing!

Dafa, it seems like you are suggesting creating my own form to filter and assign values to the bridge table. I can certainly do that but I was trying to avoid that by using the one that the Trongate app built for me. I thought there might be some way to change the Trongate provided code to include a filter but I guess not, so I will build it myself then. Thank you for your help!
#7
Hi mjim,

There is no reason why you can't modify the generated code the desktop app gave you or use it as a guide and create your own. You have to remember the Desktop app is not a replacement of doing your own coding - it's more of a scaffolding to get you going quickly. Then it's up to you to create your own custom code for the app you are working on.
#8
Yes, that makes sense Dafa. I really like the way the many-to-many associate record pop-up works so I want to use that and build a filter into that so it only showed a limited set of records that I pre-define, so I was hoping someone had figured that out already. :)
#9
You could share your code and db here or on the SCA forum and if there's enough information I'm sure it can be solved.