Customisation
Customisation
You can easily add custom attributes for base, manufacturer and supplier components, enabling additional information to be stored. For example, you may wish to implement some basic inventory control, and therefore introduce a new attribute called “Stock”. A custom attribute can be of any type and is shared across the dedicated database by all users.
Create New Custom Attribute
To start, suppose that we wish to add a “Stock” attribute to the manufacturer component object to monitor the inventory. Log in at ciiva.com as a database administrator, then locate the target database under “Database Management” and click “Edit”. Switch to the “Customisation” tab and you will see a list of custom attributes, which will be empty for a new database.
Click “New Custom Attribute” to create a new custom attribute. Here you can see:
- Attribute Name: the name of the attribute.
- Object type: the object to which this attribute is applied. It can be chosen from the three component types.
- Is Mandatory: if this attribute must be specified.
- Data Type: there are five basic data types you can choose from.
- Boolean: true or false.
- Integer: you can specify minimum and maximum values, and whether the value is unique. If you tick “Auto Increment”, then when you create a new component in your database, this attribute will be shown as the maximum existing value plus one.
- Decimal: similarly you can specify the value range in the “Data Size” field. The format is “Max Integer Digits, Max Decimal Places”. Hence, “10, 5” means a maximum of 10 digits before the decimal and 5 digits after the decimal are allowed.
- String: you can specify the length of the string in characters and whether it is unique.
- DateTime: a type representing the date and time.
- Default Value
In our inventory example, the “Stock” attribute will have a base type called “Integer”. As stock has to be a non-negative integer, we set its minimum value to zero.
Once you have finished, click “Create” and wait for the page to be refreshed. Once the attribute is shown under “Pending Changes” on the right, you can click “Commit Changes to Database” to confirm the change. If you want to add more attributes, repeat the steps above as required before clicking the commit button.
Now you will be redirected to the “Customisation” page. A new attribute called “Stock” should appear in the list. To edit or delete it, simply select the corresponding links in the “Action” column.
If your Ciiva client is running, you will need to restart it. When you log in to the client, a dialog box will show up, informing you of the database schema change.
Click “OK” and restart the client when prompted.
When the client has restarted, select any manufacturer component in the component navigator and you will see the new attribute “Stock” shown in the properties window.
You can update this attribute value in the same way as any other. If the specified value fails the validation (wrong data type, exceeds minimum/maximum range, etc.), a warning prompt will be shown.
Create New Enumeration
Imagine that we need to add a new attribute “Color” to the manufacturer component object, and that we want its value to be one of the following: White, Black, and Grey. The five basic data types cannot satisfy our requirement, and this is when using a custom enumeration is necessary. A database administrator can define an enumeration that serves as a base data type, which restricts an attribute to assuming certain discrete values.
The first step is to select “Enumerations” next to “Custom Attributes” under the “Customisation” tab. Click the “Create New Enumeration” button and enter a name. A new table named “Enumeration Values” will be shown to the right after you update.
Now go back to “Custom Attributes” and create a new attribute named “Color”. When choosing the data type, you will find a new entry “Enum-ColorEnum” available among the base data types. Click “Create” and confirm your changes.
Since we have created a new attribute, the client will detect the database schema changes and start the synchronisation process automatically. Now when you select a manufacturer component, you will see the “Color” attribute with a drop down list containing the three enumeration values.