The following is a quick explanation for how to create a Join using the Exago .NET Api.
First, ensure that your application is referencing the Join and Entity classes, which are located in the WebReports.Api.Reports namespace.
/* Manually Creating a Join */
Join myJoin = myApi.Joins.NewJoin();
myJoin.EntityFromName = myApi.Entities.GetMnemonicFromId(myEntity1.DbName);
myJoin.EntityToName = myApi.Entities.GetMnemonicFromId(myEntity2.DbName);
myJoin.JoinColumns.Add(myJoin.EntityFromName, "CategoryID", myJoin.EntityToName, "CategoryID");
myJoin.Type = 0;
myJoin.RelationType = 0;
myJoin.Weight = 0;
For more information on the properties of a Join, see Joins.
NOTE: Joins created in the API are unique to their session.
Use the convenience method, myApi.Joins.NewJoin() to create a new join.
Data Objects make use of several different identifiers: An "Alias", which is the user-visible name for the object, and an "Id", an identifier which allows for data objects with the same name from multiple data sources.
The following method returns the internal identifying string, i.e. mnemonic, for a data object:
Select the data objects that you are joining:
myJoin.EntityFromName and myJoin.EntityToName - These fields accept the entities' mnemonic string.
NOTE: Your join must have a From object and a To object.
Next, add the join columns using the following constructor. You can add multiple sets of join columns in this manner.
myJoin.JoinColumns.Add(myJoin.EntityFromName, "FromColumn", myJoin.EntityToName, "ToColumn");
Finally, set the properties of the join.
myJoin.Type - This is an integer value representing the join type:
- 0 - Inner
- 1 - Left Outer
- 2 - Right Outer
- 3 - Full Outer
myJoin.RelationType - This is an integer value representing relation type:
- 0 - One to One
- 1 - One to Many
myJoin.Weight - This is an integer value (0-99) representing the join weight.