I have a table "People" related with two other tables, "Country" and "Gender", like this : [Country] <- [People] -> [Gender].
My goal is to create a Linked Sum (SR) of table "People" in the table "Country" that matches a foreign key of "People" from table "Gender".
Thanks for some help with this issue.
The case you specified (taking into account your comment) is not solvable by a Linked Sum. A Linked Sum calculated a single result, but in your case what you are looking to calculate outputs multiple results. Furthermore, the number of results is not fixed since its dependent on the Gender table, so creating additional field and Linked Sums will not solve it either.
You will have to rely on a more complex pattern called Sum and Create Records (ST).
For this to work you will need an additional table to hold those multiple results that will combine the Country table with the Gender table and will save an output for each combination of those. Lets call it G_C (Genders per country).
It will need a foreign key to Country, and another foreign key to Gender, and a numeric field to hold the sum.
The People table will also need a foreign key to G_C
Then in the numeric field you setup a normal Linked Sum (SR) to count the people [People->1]
In the foreign key to the Country you setup a Create Record (ST) to copy the corresponding relation in the Person [Person->CODCNTRY]
In the foreign key to the Gender you setup a Create Record (ST) to copy the corresponding relation in the Person [Person->CODGENDER]
With this setup, each time you save a new Person it will check if a row in G_C already exists to hold the sum corresponding to the combination (Country,Gender) and if it doesn't it will create that record. From then on the SR will work as normal.
Its a complex pattern, not used often (a report is more common in these cases) but if you take it step by step its logical to use and to understand.
About This Community
|Asked: 8/30/19, 10:01 AM|
|Seen: 421 times|
|Last updated: 9/26/19, 5:03 PM|