All Master Addendum applications are arrays. These arrays contain both the Master Record itself and all associated Addendums. Most of the screen elements that are visible in a Master-Addendum structure are created in the SynR3.js file and are based on specific process templates. Because Offline uses declarative coding, creating transactions is a very efficient process. In addition, while the standard modification methods give users the ability to edit and change screens easily, users are unlikely to become confused with the more detailed syntax of Javascript. To create a Master Record, please do the following.
It is first necessary to create the application itself. To do this, the syntax is as follows:
g_applicationdesc = { };
Therefore, if we are creating a work order, the code would be as follows:
g_WorkOrderAppDesc = { };
Once the application is created, we can assign that application a Master Record. The Master Record is the primary object in the application and contains the number of Addendums that are associated with the transaction. As previously discussed, the Master Record will have the pattern style 'APPLICATION_PATTERN_MASTER_ADDENDUM', meaning that the Master Record will always be listed before Addendums in any listing of application properties. To assign a Master Record to our application, the code is as follows:
g_WorkOrderAppDesc.MasterRecord = { };
Addendums are also array structures. They are assigned under the application, but are associated or connected with the Master Record. As discussed above, each Addendum also has a specific pattern structure. The two possible pattern styles are defined in the Properties section above. To add two Addendums of an as-yet undefined pattern to our application, we will add the following code:
g_WorkOrderAppDesc.Addendum = [{ }, { }];
Once we have assigned a Master Record and Addendums to our application. We can create Config screens for them. There will be one Config screen for the MAster Record and one for each Addendum as well. The code will be as shown below:
g_WorkOrderAppDesc.Config = [{ }, { }];
Now that we have created our application and defined the Master Record, the Addendums and the configuration screens, we can create data tables for those edit fields that have lookup information. To do this, we can use the MasterData object. This object is optional and may not be related to either the Master Record or any Addendum. The MasterData object is an array structure and will not have a screen, but will have a database table. It is possible to add multiple MasterData to a given application. To add MasterData, the code would be as follows:
g_WorkOrderAppDesc.MasterData= [{ }, { }];