Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling join with generic foreign keys #69

Open
corneille-marechal opened this issue Mar 22, 2024 · 1 comment
Open

Handling join with generic foreign keys #69

corneille-marechal opened this issue Mar 22, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@corneille-marechal
Copy link

Being able to make joins with GenericRelations would be nice.

@eirikbakke
Copy link
Contributor

eirikbakke commented Mar 22, 2024

These are foreign key columns which may point to IDs in more than one table, right?

If the IDs are unique across the different tables, then in Ultorg, you can just join on the same column multiple times. Right-click the column to join on, then click Custom Join, and pick the other table to join with and its ID.

In the example below, "Resource ID" can point to globally unique IDs in either the "Users" or "Billing Accounts" tables, and joins have been added to both tables via the Custom Join action:

image

In Ultorg, joins work like left joins by default, so the parent row under Log Entries won't "disappear" just because there exists a join without a match.

If the IDs are not unique across tables, e.g. if an ID "100" in an other_entity_id column could be either Address number 100 or Agent number 100, depending on the value in the other_entity_type column, then you could add a formula column like this (right-click any existing column and press Insert Formula After, then edit the formula like you would in Excel)...

image

...and then right-click the formula column and do Custom Join on that one against the Address table (and repeat for each type of relationship).

@eirikbakke eirikbakke added the documentation Improvements or additions to documentation label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants