Creating a new data model, adding parameters and saving your model  
The gadget spec URL could not be found



In the previous section, we learned to create folders and organize data models into folders. We created the folders "Catalog Menu" and "Orders Menu" under the root folder. In this section, we will learn to create a new data model.

How do I create a new data model? 

You can create a new data model by clicking on the new model icon in the design perspective.

  Create a new data model 


In this exercise, we will create the category model and add two parameters -- category code and category description.


To create a new model, click on the new model icon in the design perspective.
   




A dialog box will be displayed. Select the folder under which the new model is to be created, enter the name of the new model to be created, and then click on "Create Model" button.
  
 Create the category model under the catalog menu folder.



The newly created category model will be displayed as shown. 
  
What's the next step?
 Adding parameters to the newly created category data model.

  Adding attributes to the newly created data model 



To add a new parameter, click on the add new parameter button. 



Enter the paramter name, select the datatype, and then click on the OK button to add the new parameter.

Additionally, you could also select the position for the parameter in the spreadsheet like grid in the rules perspective.



 Adding category code parameter
  

Let's add two parameters -- Category Code and Category Description -- to the category model.

Click on the add new parameter button and enter the following values for the required fields.

- Enter "CategoryCode" in the Name field.
- Select "Text" from the dropdown list for DataType field.




Click on the OK button to add "CategoryCode" parameter to the category model.




 Updating the properties of a parameter
  
To edit the details of an existing parameter, click on the edit button next to the parameter and update the values.


You can either update the name or datatype of a parameter. The position cannot be updated. 



 Rules perspective 
  
When a new parmeter is added to a model in the design perspective, it becomes available in the rules perspective as shown. If the position is not selected while adding the parameter, the system automatically chooses the next available place in the grid and adds the parameter.
   




 Default form
  
A default form is automatically generated based on the public cells in the rules perspective. You can see that the the CategoryCode parameter is present in the automatically generated default form for the category model.
   




 Adding category description parameter
  
Click on the add new parameter button to add the category description parameter to the model. 
 
Enter "CategoryDescription" in the Name field and select "Text" from the dropdown list for DataType.



 Positioning the parameter
  
Click on the position icon. A preview of the grid in the rules perspective will be displayed. The location of the new parameter in the grid will be highlighted.



You can select on any of the available places in the grid as the location for the new parameter. Select A4 as the position for the Category Description parameter and then click on the OK button.
 




Click on the rules tab to navigate to the rules perspective. You can notice that the category description parameter has been added in cell A4 and its corresponding display cell in cell A3.
   




Click on the forms tab to navigate to the forms perspective. You can notice that the category description parameter is available in the default form in the same position as in the grid in the rules perspective.
   




 Previewing default form
  
Click on the preview tab at the bottom to view a preview of the automatically generated default form.
   


  Updating the data model properties



The model name or its properties can be updated by clicking on edit button next to the model name. 
 
By default, the model will not be visible  and the worklfow will not be enabled for a model. These properties can be changed by selecting the appropriate value.



Once the required changes have been made, click on the save and close button to save the changes. Alternatively, you can click on the cancel button to discard the current changes.

In addition, you also have the option to save the changes as you work by clicking on the save button.
   




Once the model is closed, the category model will be displayed as shown. You can double click on the model or clck on the edit icon to open the model.