Model editor

            Model editor is an advanced feature which allows to make a lot of customizations of the default setup. In this article, the following topics will be covered:
            • Default application options
            • Field captions
            • Localization
            • Calculated fields
            • Conditional formatting
            To launch Model editor, select Tools tab on the ribbon and click Edit model. You will see the following window:

            It contains a lot of different nodes and sub-nodes, each with its own properties and intention. As this tool must be used only by administrators, it is not recommended to make any changes here if you're unsure what you're doing. Please, follow recommendations from this manual to make described changes and avoid touching undocumented nodes. Of course, you may try to experiment and change anything you like. If something will go wrong, you can always reset all changes.


            Options node of the Model editor contains a number of important settings.

            First interesting option here is FormStyle. You can select between ribbon (default) and classical menu style. Classical menu allow to save some vertical space.

            Another very important option is DataAccessMode. By default, the value here is Client. This means that when any list form is opened, all data will be loaded into the RAM. However, when the program is used in network mode, your Internet connection may become bottleneck and lead to long loading time of different forms, To improve performance in this case, you can use Server or InstandFeedback modes. Recommended value is InstandFeedback, but you may experiment with these settings and see which one will give better results.

            If to expand Options node, you will see few sub-nodes here. In the LayoutManagerOptions node you will find a number of settings which define forms composition. For example, you can decrease properties ended with ...Distance to make the whole UI more compact. In the PrintingOptions node you can change default paper options used to print documents. In the RibbonOptions you can change RibbonControlStyleproperty to change ribbon appearance (for example, to make it more compact).

            FIELD CAPTIONS

            Model editor allows to rename any field you may find on any form of the application. To achieve this, use BOModel node. This node contains few sub-nodes, and it may be difficult to find what you're looking for. In general, all reference data types can be found in the BaccS_XAF.Module.BusinessObjects.Spr node, while operations (documents) are placed to the BaccS_XAF.Module.BusinessObjects.Doc node. Also you can use Search function to find necessary entity. Here is an example showing how to find TranslationAssignment entity type:

            Click on the found object, and it will be immediately selected in the main tree. Then, expand this object and expand OwnMembers node inside it. This OwnMembers node contains all fields of the selected entity. Select any member and change its Caption property (or any other property). In the following example we'll select AmountBase member and change caption from Amount (base cur.) to Amount (USD):

            Close Model editor, save changes and switch to the Translation assignments list. New caption is applied:


            If your native language is not supported, you can localize BaccS manually. To do this, open Model editor and find Languages filed on the tool-bar. Click on it and select Languages manager... Click Add button, select desired language and click OK.

            Click OK again to return to the Model editor. Then, click Localization button. Provide translations or save the list to translate it in external application:

            If you decide to manually localize BaccS into any language which is not provided by default, we'll be grateful for the shared localization results.


            In previous section (Custom fields) you've learned how to create fields stored in the database. However, sometimes it is not necessary to store custom fields in the database since they are calculated on the base of values entered in other fields. In this case, such fields will be calculated each time you read or display corresponding entity. To demonstrate calculated fields functionality, let's create a field which will display number of overdue days for unpaid invoices.

            1. Open Model Editor and find the following node: BOModel - BaccS_XAF.Module.BusinessObjects.Doc - Invoice - OwnMembers.

            2. Right click on OwnMembers node and select Add - Member. A new member will be created with random Id assigned.

            3. In the Id field enter OverdureDays.

            4. In the Type field select System.Int32 (because number of days is an integer value).

            5. In the Expression field, open expression editor and compose the following expression: Iif([Term]<Today(),  DateDiffDay(Today(), [Term]), 0). This expression can be composed using helpers provided by expression editor - no need to type it manually). As you see, we used few functions here: Iif (accepts three parameters: logical expression, returned value if expression is true, and returned value if expression is false),Today() (return today's date) and DateDiffDay (returns number of days between 2 dates). Click Ok.

            6. Select Invoice node above OwnMembers and find DefaultListView property. Click on the Open button.

            7. ListView node will be opened. Expand it, right click on the Columns node and click Add.

            8. In properties of added column select OverdueDays in the PropertyName property.

            9. Save changes, close Model Editor and open Invoices list. You will see the new column:

            10. From now, each day value in this column will be changed automatically. In addition, you can apply conditional formatting rules to highlight invoices which overdue, for example, for 60 days.


            Model editor can be used to setup conditional appearance rules of different fields in tables or editing forms. Full description of this feature can be found in the corresponding article.

            TAB CAPTIONS

            BaccS has tabbed interface. When you open any table or editing form, a new tab is created. Captions of those tabs has some predefined format, which depends on the object type. For example, for the Unit tab caption will contain unit name. For the invoice, it will have a form of 'Invoice [number]', where number will depend on the Number field. For the job, tab caption has a form of 'Job [PONumber]'. You can customize tab captions according your own preferences. To achieve this, do the following:

            1. In the model editor, find necessary object type, as described above. For example, let's find Translation job node:

            2. Click Open button in the DefaultDetailViewProperty. This form will be selected in the tree:

            3. In the Properties pane find ObjectCaptionFormat property (at the bottom) and correct it according your needs. To include any field from the Job object into the caption, use {0:FieldName} structure. Here is an example showing how to include job number and date into the tab caption:

            Job {0:Number} dated {0:Date:d}

            4. Save changes, close model editor, and open any job editing form. Here is the result:

            Updated: 27 Feb 2019 10:29 AM
            Help us to make this article better
            0 0