Automatically choose multiple records based off another record

I’m building a mobile app focused focused around a user’s Members of Congress.

While signing up, I’m having the user choose their own Representative through a drop-down menu (filtered by their state), but how can I use the user’s state to automatically choose/add their two Senators? (i.e. when the State record is submitted, it can automatically add the two Senators using the User’s state)

Another piece of knowledge - I have 3 interconnected databases: users + Members of Congress + states. Users are associated to a state, and Members of Congress are associated to a state. Since there are 2 types of Members of Congress, I just used True/False (True = Senator, False = Representative).

TLDR: To eliminate a signup step, is there a way to use the User’s state to automatically add their Senators? I’ve been researching for a minute, but having trouble on how to accomplish this. Thanks!

EDIT: for those outside of the US, every citizen has 3 Members of Congress = 2 Senators that are the same for everyone in the same state + 1 Representative that is dependent on district/region within the state.

When a person selects a state on signup, if as you say the members of congress are linked to that state, this would mean just by signing up using that state then the members of congress are automatically linked to that user. You just need to build the means to show it somewhere.

Personally I would not use true/false in the way you have, I would create 2 different fields (something like ‘is senator’ true/false AND ‘is representative’ true/false) within the members of congress collection and as long as the state is still linked to the members of congress collection and the user collection, you can show both fields however you wish.

Hope this helps. Let me know if you need any further detail :slight_smile:

1 Like

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