Sets reference in field value

  • The esProc fields can also be used to store several records or sets. The field of the primary table in database usually corresponds to several records in the sub tables. Therefore, with the object reference, esProc can easily represent the correlations between the primary table and the sub table.
  • As illustrated below, the primary table Department table has an Employee field. The Employee field of every record point to the several records of sub table Employee table.
  • The cell A4 retrieved a record from Department table. Then, the statements followed can use A4.Employee to access to the set of records in the corresponding sub table of this record.
  • A4.Employee.avg(Age) represents the summarization of Age field of this set.
1 =db.query(“select * from Employee”)
=db.query(“select * from Department”)
The new fields is assigned with the reference to the subset from other tables
5 =A4.Employee.avg(Age) To sum up and average the sets of referenced sets,and get 40.75