Topic: Two foreign keys from same table.

I have a table_1 (AA_011_MF_SWITCH) where there are 2 foreign keys (for source and destination) from another table_2 (LU_003_FUND_SELECT). While setting up an auto-query for a table grid on table_1, how to distinguish between the 2 keys? (i.e get the right source fund and destination fund from table_2). Please help.

Post's attachments

Attachment icon 2_foreign_keys.JPG 75.63 kb, 108 downloads since 2020-11-14 

Re: Two foreign keys from same table.

Hello,
I have created calculated fields in table_1 to get the right data from table_2. Is there a better way?
Eyeman303

Post's attachments

Attachment icon foreignkeys_calculated_fields.zip 67.55 kb, 226 downloads since 2020-11-14 

Re: Two foreign keys from same table.

eyeman303,
That's the way to do it.

Re: Two foreign keys from same table.

ehwagner wrote:

eyeman303,
That's the way to do it.

без проекта не понятно, что именно вы пытаетесь сделать.
without a project it is not clear what exactly you are trying to do.

Re: Two foreign keys from same table.

Hello Ehwagner and Sibprogsistem
Thanks for endorsing the method. The data are correctly displayed in the table grid.
The project is about creating a Mutual Fund Database. One table_1 (AA_011_MF_SWITCH) stores mutual fund switches between Source_Fund and Destination_Fund. This data is collected by form AA_Form_011_MF_SWITCHES_RECORD, which contains two combo boxes for Source_Fund and Destination_Fund. The dropdown list in these fields refers to the foreign keys from the lookup table of mutual funds (LU_003_FUND_SELECT). I was in doubt about how to get the correct Source_Fund and Destination_Fund, from the lookup table, when a table grid auto query is set up to get all data from the  table_1. Finally creating calculated fields in table_1 for Source_Fund and Destination_Fund gets the correct data.

Post's attachments

Attachment icon 2_Foreign_keys_Form.JPG 55.43 kb, 115 downloads since 2020-11-14