HOME COMMUNITY BLOG

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Another field type - the aggregated field - creates a calculated field using an aggregate function (Count, Sum, Average, Minimum and Maximum). First you must create a relation to the entity that contains the fields you want to summarize. Right-click on the entity that will contain the aggregated field and select New > Relationship.



  2. From the drop-down list select the RelatedEntity. The field Name will be automatically filled with the name of the related entity, but you can change it.



  3. After saving you have to add a Relationship Key. Right-click on the relationship and select New > Key.



  4. A new tab will open. The field Name will be automatically filled with the name of the related entity, but you can change it. As the BaseEntityField select Id and as the RelatedEntityField select the corresponding field from the related entity, i.e. a foreign key in the related entity that is linked to the Id of the base entity (you can find a step by step tutorial for creating a foreign key here). Save.



  5. In case that you don't already have two entities (and database tables) but only one, you can also use the Create child entity wizard. Right-click on the name of the parent entity and select Actions > Create Child Entity.



  6. Fill in the Child Entity Name for the new child entity. The Master Entity is already filled. There is also an option to add another parent entity.  Click on OK.



  7. The wizard will finish all steps for you - it will create a new entity with a foreign key, a relationship between the entities and also an index for the child entity.

    Image Modified

  8. Now that you have two entities in a relationship, you can finally create the aggregated field. Right-click on your entity that will contain the aggregated field and select New > Aggregated Field.

    Image Added

  9. A new tab will open. From a drop-down list select the AggregationType. Then select the Relation from a drop-down list - this is the entity you have created the relationship to. Then from a drop-down list select the Field whose values will be aggregated. The Name will be filled automatically, but you can change it. The attributes Caption, DataLength and DataType will be inherited from the selected Field. Save.

    Image Added

  10. You have finished creating the aggregated field. One last task remains if you want the field to recalculate automatically with every change in the detail data. You have to add the related entity as a child entity to the master entity's data structure. If you don't have one yet, go to Entities and right-click on the entity's name and select Actions > Create Data Structure and it will be generated.

    Image Added

  11.  Expand Data Structures in the Data Model in the Model Browser. Then expand the folder of your project and find the data structure of your master entity. Expand it and then again expand the subfolder Entities. Right-click on the entity and select New > Entity.

    Image Added

  12. In the new tab find the attribute Entity and from a drop-down list select your child entity. The Name will be filled automatically. Save and you have completed the process of creating an aggregated field.

    Image Added

Lookup Field

  1. xxx


  2. xxx
  3. xxx