Property Class Structure & IDO Integration
The inheritance model
Mongoose has many inheritance strategies that provide powerful facilities for reducing the development effort and increasing the consistency of your application.
This allows you, as a developer, to create reusable classes that can be used throughout an application with a single point of maintenance. The image below illustrates all the different levels in which a class can be inherited.
Property classes
Property classes are applied at the IDO level and can hold various data attributes. When a property class is applied to a property, it inherits those attributes.
Launch Mongoose, and then launch the Web Designer by clicking the “Open designer in a new window” toolbar icon.
Open the Customer form from the Form menu.
Select the IDEdit component, and on the Properties panel on the right, expand the Data Source section, and then expand the Data Type section.
Notice that the Length is 0. However, we are, in fact, limited in the number of characters we can type. This is because the length is being inherited from our ID property.
If the length was changed here, at the component level, it would override the length defined at the property level.
To view the attributes that a component is inheriting from the IDO, navigate to the Properties panel and expand the Inheritance section. Next to the View Attributes Inherited property, click the ellipsis (•••) button.
This opens the IDO Properties form, with the ID property selected and displays all of the attributes that are defined on the property. Here you should be able to see your length of 50 that is being inherited from the property, the zero that we saw earlier was the length that was defined at the component level.
You can use this form for reference, or to make changes on the fly.
Creating a property class
In this next part, we are going to create a property class that will be used to store data attributes that will be used when we create our Unit of Measure form.
Start by switching back to the runtime mode tab and add a new shortcut for the IDO Properties form:
- Open the Mongoose Explorer if it is not already open.
- Right-click the My Folders submenu.
- From the popup menu, select New Shortcut.
Locate and select the Property Classes form.
Click Ok to create the form shortcut.
Click on the shortcut to open the Property Classes form. Execute Filter-In-Place by clicking the toolbar icon or by pressing F4.
Create a new Property Class by clicking the New icon from the toolbar (Circled Here), or by pressing CTRL+N.
Add a Class with these properties:
- Class Name: UMBase
- Data Type: String
- Column Data Type: nvarchar
- Label String ID: sUM
Click Save.
Close the form and run Unload global form objects (Form > Definition > Unload All Global Form Objects).
Building the Unit of Measure facility
In this next part, we are going to build out our Unit of Measure facility that will eventually be used when we create our Items facility. We will be using the New Data Maintenance Wizard (NDMW) to do this and will apply the UMBase property class we created in the previous section.
Launch the Web Designer, In the Identify Your Editing Scope dialog box, select Site Default, and then click Ok.
Click the New Form Definition icon from the toolbar.
Or from the Form menu select Definition > New.
In the Form Wizard Selection modal, select these options:
- For the Category, select NewData.
- For the Wizard, select Maintenance.
Click Ok.
In the New Data Maintenance Wizard, set these fields to these values:
- IDO Name: UMs
- IDO Project Name: HelloWorld
- Table Alias: ums
Leave all of the other defaults as is.
Use the Add Row button to create the two properties listed here:
UM | UMBase | String | 10 | Y | Y | |
Description | String | 50 | sDescription |
To create the table and IDO, click Next, and then click Finish.
When prompted, to create the form, click Yes.
Step through the New Form Wizard, leaving the default values as they are.
Click Next.
Click Next.
If needed, reposition the fields on the form so that UM is first and Description is second.
Click Next, and then click Finish.
Click Ok.
Click Close.
After the form opens in the Web Designer, if there are any labels prefixed with an “s” that means that the strings are new and need to be created. From the Properties panel, on the Caption property click the ellipsis to define the string value.
In this example, the sUM string value needed to be created.
Change the String Value name to Unit of Measure.
Click Ok, then Save.
Return to the Runtime Mode tab and open the new UMs form. You will notice now that our label is showing the correct string value that we just created.
Add these two records, using the New icon from the toolbar to add each row:
EA | Each |
DZ | Dozen |
Click Save.
Create and extend our property class
Now we want to build onto the inheritance model, by utilizing a base class when creating a property class. When we utilize a base class, it will inherit any attributes defined on that property class, and allows you to override any of those attributes.
In the Runtime Mode tab, using the Explorer. Open the Property Classes form. Collapse the Mongoose Explorer so you have more workspace by clicking the Explorer menu item.
Execute Filter-In-Place by clicking the Filter-In-Place icon on the toolbar.
Create a new property class by clicking the New icon on the toolbar.
Add a class with these specifications:
- Class Name: UM
- Base Class: UMBase
- Domain IDO: UMs
- Domain Property: UM
- Additional List Properties: Description
Use the New icon from the toolbar and create two more property classes:
ItemBase | String | 20 | nvarchar | sItem | ||
Cost | Decimal | 18 | 2 | 0 | decimal | sCost |
ItemBase Property Class:
Cost Property Class:
Click Save.
Close the form and run Unload global form objects (Form > Definition > Unload All Global Form Objects).
Create the Items facility
Now we want to create our Items table IDO and form.
Switch back to the Web Designer, with a scope of Site Default, launch the New Data Maintenance Wizard (NDMW) (Form > Definition > New).
In the Form Wizard Selection form, make these selections:
- Category: NewData
- Wizard: Maintenance
Click Ok.
Use these settings:
- IDO Name: Items
- IDO Project Name: HelloWorld
- Table Alias: itms
Keep all of the other default values, and create the four properties listed here, using the Add Row button to add each property:
* The property class supplies these values automatically.
Click Next, and then click Finish.
When asked if you want to create a form, click Yes.
Once the New Form Wizard launches, leave the form Name and Data Source fields set to Items, and click Next.
On the Properties page, keep the default selected properties and click Next.
On the next page, reposition the properties so that they are in this order:
- Item
- Description
- Cost
- UM
Click Next, and then click Finish.
Click Ok.
Click Close.
The form is now created. (Example shown below)
Optionally, create the translatable strings for the Item field label and the Cost field label.
Using the Items form
Return to the Runtime Mode tab and open the newly created Items form. The form opens in Add mode by default.
Notice that the UM or Unit of Measure field is now a ComboBox component, instead of the standard Edit component. This is because this property is inheriting a domain list from the property class, which provides a list source for the component.
We want to test the built-in validation provided by the Domain list: This ensures that the user must select a valid item from the list source (in this case, the Unit of Measure field).
In the UM field, type: DZZ. And then tab out of the field or click the Save icon. The system displays an error message that “DZZ is not a valid UM”
Using the New icon from the toolbar, add the following records on the Items form:
Bike | 70s Road Bike | 100 | EA |
Dumbbell | 45lb Iron | 45 | EA |
Guitar | Natural Acoustic | 129.99 | DZ |
Eggs | Cage Free Chickens | 3 | DZ |
Click Save.
Summary: See diagram below
We created the property class um base where we assigned the label string id sum, then we created another property class named um which was derived from um base. Which means it inherited the label string id sum on this level. We added the IDO domain information which allowed us to have a drop list of items and validation from the um’s table next we created. The property um which was derived from um base meaning that again the label string id sum was inherited. After our um’s form was created, an edit component that was bound to the um property inherited that same label string id.
Here is the Part 2 video showing the detailed steps to complete the previous tasks.
What made this section unhelpful for you?
On this page
- Property Class Structure & IDO Integration