Skip to main content

Creating the Model Class: Properties

The first step in creating our Zen MVC form for updating contact data is to create a model class:

  1. Use Studio to create ZenTutorial.ContactModel. The class extends %ZEN.DataModel.ObjectDataModelOpens in a new tab:

    
    Class ZenTutorial.ContactModel Extends %ZEN.DataModel.ObjectDataModel
    {   
     
    }
     
  2. Add the following property declarations to the class:

    
    Class ZenTutorial.ContactModel Extends %ZEN.DataModel.ObjectDataModel
    {
    Property Name As %String;
    
    Property ContactType As %String
    (ZENSQL="SELECT DISTINCT %EXACT ContactType from ZenTutorial.Contact");
    
    Property Street As %String;
    
    Property City As %String;
    
    Property State As %String;
    
    Property Zip As %String;     
    }       
    

    These properties all represent properties of ZenTutorial.Contact or ZenTutorial.Address. Note the ZENSQL parameter for the ContactType. This parameter uses a query to define the possible values for this property. In this case the values are: Business and Personal.

FeedbackOpens in a new tab