@openapi.openedge.entity.primarykey (fields="CustNum").
DEFINE TEMP-TABLE ttCustomer BEFORE-TABLE bttCustomer
FIELD id AS CHARACTER
FIELD seq AS INTEGER INITIAL ?
FIELD CustNum AS INTEGER INITIAL "0" LABEL "Cust Num"
FIELD Country AS CHARACTER INITIAL "USA" LABEL "Country"
.......
@openapi.openedge.entity.primarykey (fields="Ordernum").
DEFINE TEMP-TABLE ttOrder BEFORE-TABLE bttOrder
FIELD Ordernum AS INTEGER INITIAL "0" LABEL "Order Num"
FIELD CustNum AS INTEGER INITIAL "0" LABEL "Cust Num"
FIELD OrderDate AS DATE INITIAL "TODAY" LABEL "Ordered"
.........
DEFINE DATASET dsCustomerOrder FOR ttCustomer,ttOrder
DATA-RELATION drCO for ttCustomer,ttOrder
RELATION-FIELDS (CustNum, CustNum) .
I used the above schema to create a business entity but the datasource-table are not automatically filled.
Also how to create count function for this buisness entity.
Hi Ashon,
When you create a BusinessEntity by specifying a schema, it is left to the developer to fill-in the corresponding data-source tables to be used in your backend resource, since we cannot make an accurate guess as to what table the developer is intending to use. As an example, if you are using the sports2000 db, you update the following statements as below:
DEFINE DATA-SOURCE srceCustomer FOR <datasource-table>.
DEFINE DATA-SOURCE srceOrder FOR <datasource-table>.
DEFINE DATA-SOURCE srceCustomer FOR Customer.
DEFINE DATA-SOURCE srceOrder FOR Order.
The count function should return the number of records for the parent table. As in the example above, that would be for the customer table. See link below for example BE count function
documentation.progress.com/.../
Maura