BizAgi Tables and m-m relationships - bizagi

BizAgi tables are used to view collections in 1-m relationships.
It is also possible to view m-m relationships from the point of view of one entity (thus, a 1-m relationship).
The add and delete buttons don't work with m-m relationships and no errors appear.
Has anybody used them successfully?

My interpretation with an example:
One contract has N clients, and one client has N different contracts. You want to use collections to represent this connection.
The only was I see of representing this information is to have a table of contracts, to which the edit/detail form shows a table of clients for that contract.
You might also want to consider using a form link as a column of that table.
Let me know if this is a correct interpretation.

Related

Entity Framework one-to-one relationship between multiple tables

I have three entities that need to be linked. In my scenario, I have three tables users, stores and accounts.
Both users and stores can have zero or one account and each account should be either for a store or a user (see image below).
I need a one-to-one relationship between user-account and store-account. Since one-to-one relationship force the model to use one key, the user and store Ids might have conflict.
Is there any solution for this in Entity Framework or do I have a flaw in my design?
It would be much easier to use intermediate tables user_account and store_account, that would store only keys. This way you can enforce any logic you want.

CUBA : attributes for many-to-many association

Is there a standard way in CUBA to modelize attributes for many-to-many association ? Documentation omits the topic so I guess it is not. In this case, is this in the roadmap ?
For many-to-many association (e.g between Products and Providers), CUBA Studio generates automatically a link table (holding Provider ID and Product ID).
In order to handle specific attributes to this association (e.g Boolean preferredProvider) it would need to add the preferredProvider column in the link table and create a class holding the two IDs and the attribute.
It would also probably impact the platfom mechanism of fetching many-to-many associations.
I'm reasonably sure that CUBA Studio does not manage it as of 2.2.3 - no option in Studio GUI, nothing in doc. It is still of course possible to code the case manually but one would need to manually write JPQL. Not necessarily a big deal but losing a strong feature of the platform here just for one field.
So I created the preferredProvider field as a one-to-one association from Product to Provider, which is a valid workaround at the cost of an additional association.

many-to-many database

I'm trying to create a database to analyze the configurations of my servers.
But i have many services that can run on many servers (for failover/load balancing). Also, the configuration of a same service can change from one server to an other, this is why I can't just have a service table
I tried to link the different tables using a single table that tie them all together. I think i'm in NF3 but i'm not 100% sure.
Is that a "valide" database design? database design
I fear that the request to find stuff in the database are going to be a bit complicated.
thank you
It would help more if you showed the actual db design. But...
If you have two tables associated in a many to many relationship, you will need a table in between them that represents the relationship. Tables normally represent entities in the real world, and foreign key represent the relationships. But in a many to many relationship you need a table to handle that complexity.
That table represents and could be called ServiceRunningOnServer and it's primary key should be the combination of a ServiceId (with a foreign key to Service.Id), and a ServerId (with a foreign key to Server.Id).
Any setting for a service that is across the board (not server specific) is an attribute of the service entity and so belongs in the Service table. But any setting that is specific to the server it is running on, is an attribute of the relationship between that service and that server and so it belongs in the ServiceRunningOnServer table.
Yes, this is a perfectly normalized db design. And actually it is the design with the most optimized complexity. Meaning that other designs might make some things easier, but they will also make other things harder. In the end, and in the total sum of things, other designs will over-complicate things. This design will keep the total complexity of adding, updating, reading and deleting data from your database to a minimum.

How to force powerpivot relationship to be one-to-one?

Actually, I would be satisfied just getting to pick the direction of the one-to-many. I have one table, the result of a SQL query that I want to use as a lookup table. It is unique in its key column, but I don't know how to tell Powerpivot that. I have another table which is linked from Excel where the user can type in a key to look up stuff in the big table. When I use diagram view to connect these tables, it creates a many-to-one relationship in the wrong direction and then RELATED('lookuptable'[key value]) fails. There is really a one-to-one relationship between the one row supplied by the user and some row in the big table. How do I convince PowerPivot of this? The version I am using is 2016.
You can change which is the lookup/1-side table and which is the many-side, either by clicking and dragging from the many to the one, or by switching the tables in the edit relationship dialog.
Coming eventually for 2016, likely no later than the GA release of SQL Server 2016, is the concept of a bi-directional relationship in which filter will flow both ways between the tables in a relationship, and hopefully many-to-many support natively along with that.
Edit:
In the Create Relationship dialog menu, whichever table you define on the left will become the many side of the relationship, so you can simply create the relationship through this dialog.
That being said, I have confirmed that when defining a relationship in Excel 2016 by clicking and dragging fields, the field that you drag becomes the many side of the relationship, and the field that you drop on becomes the one side of the relationship. The arrow points in the direction that filter context will flow (note that this is the opposite direction of the lookup arrows in previous versions of Power Pivot). Filter context follows the arrow, but calls to RELATED() or RELATEDTABLE() go in the opposite direction of the relationship arrow. You can only call one of the RELATED*() functions from the table that the arrow points to. If you need to reverse the relationship, just delete and redefine it by dragging from the other table.
To modify the relationship in the Edit Relationship dialog menu, you will need at least three tables in the model, and you will then need to juggle the tables, using the third table to allow selection of the first two appropriately.
Edit 2:
It turns out that the edit relationships dialog launched by Relationships in the pivot table Analyze ribbon menu does not behave in the same way as the Power Pivot dialog, and so the following works to switch relationship direction regardless of how many tables are in your model. Table is the many side, Related Lookup Table is the one side.
One to one relationship is currently not supported in Power Pivot for Excel. It looks like it is only supported in Power BI.
See links:
https://exceleratorbi.com.au/relationships-power-bi-power-pivot/
https://social.msdn.microsoft.com/Forums/en-US/9aafb848-8853-40a5-b91f-f6094779c99e/onetoone-relationship-not-working?forum=sqlkjpowerpivotforexcel

Associative Relationship With Multiple Tables (MS Access)

I've not really used access for a while and not too sure how best to proceed with this data model:
I have set of resource tables of differing type, eg: Data, Literature, Contractors, etc.
I also have a set of category tables such as Procedures, Topics, and Regions.
I need to create many-to-many relationships between the various resources and the various categories so it is possible to view a resource record and see lists of the various categories to which the resource is allocated, and vice-versa, that is to view all resources allocated to a specific category.
I realise that I could create lots of link tables, eg: LnkDataProcs, LnkDataTopics, etc, however with perhaps 10 resource tables and 3 category tables I would wind up with 30-odd link tables which seems wrong (it may also be useful to query all resources from each category anyway so it would be good to have one link table for each category).
I've done this kind of thing before using SQL in custom DB client apps by using one link table with fields as follows: CategoryTable, CategoryID, ResourceTable, ResourceID - So that the link table stores the table name as well as the foreign key.
However I'm not too sure how to fit this kind of model into an access database, it would be nice to use the Access framework (master-child form objects) rather than having to write loads of custom code to perform queries and populate forms.
Any ideas how to proceed, or even what this kind of relationship is called?