Create Objects With Data from Multiple Tables
You can create objects with data from multiple tables, compared to batch generation where objects are always created for one table only.
Go to Integrate > Data > Datasource.
Open an existing, working SwatEntity and click the Copy button.
The Copy Object Dialog opens.
Enter an appropriate name in the Name of new object field. It can contain for example all included tables.
Select the SwatEntity to be copied in the Source Object field.
Click the Ok button.
Adjust the following attributes in the Attributes panel :
SourceTables
: Insert all the required tables comma-separated, following the naming convention<databasename>.<tablename>
.SourceQuery
: Adjust the query to the needed one.Example ABL:
FOR EACH table1, EACH table2 OUTER-JOIN WHERE table1.keyA = table2.keyB, EACH table3 OUTER-JOIN WHERE table2.keyC = table3.keyD INDEXED-REPOSITION
EntityName
: Adjust the name (last part) to the name of the previously created entity.
Open the Instances view of the created SwatEntity and drag & drop your needed data fields from the previously specified tables into the Instances (children) of this Object panel.
Click Save.
Go to Integrate > Data > Entities + Fields and click the Generate Datasources button.
Enter the needed information and click the Ok button to create the DSO.
Open the created DSO in the Object Designer, open the Instances view and select the entity.
In the Attributes panel, enter a name in the
name
attribute and add an 'e' prefix to the name.Open the Design view again.
In the Attributes panel, enter the same name previously entered in the
name
attribute in theEntityName
attribute.Test your new DSO by opening the URL
[YOUR CURRENT GITPOD URL]/web/Resource/[RESOURCENAME OF THE DSO]
.Note
The
resourceName
for the URL is the name in theresourceName
attribute of the DSO.To Create the desired objects for the previously created entity, e. g. a grid, go to Design > Components > Grids and click the Generate Grids button.
Enter a Name by following e.g. the naming convention <name><objecttype>, a Title and a Description.
Select your created entity in the Entity drop-down field.
Select the desired fields. You can also type in an asterisk
*
to select all fields.Select the desired module.