12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Model View ControllerSince you have provided no special format for model ID values in the Person class, the default prevails. This meanseach new record you add gets a sequential number starting at 1. You may add more records by repeating steps 6 and7. The numbers increment automatically.If you try to view a record by entering an ID number that does not exist, the displays with all of its fieldsdisabled. You may click New to redisplay an active form in which to enter data for a new record.6.8.4 Step 4: Virtual PropertiesIf you want to interject changes in a data model before using it, you can override the %OnGetPropertyInfo method inthe data model class. This is the way to add virtual properties that you want to use in the model, but that do not exist in theclass that you began with. In order to use virtual properties, you must ensure that the data model class parameterDYNAMICPROPERTIES is set to 1 (true). Its default value in the %ZEN.DataModel.Adaptor class is 0 (false). You canuse %OnGetPropertyInfo with either type of data model, but it makes the most sense for an adaptor data model becausein that case you are using an existing class as a data model.This exercise adds a %OnGetPropertyInfo method to the adaptor data model class Person from the previous exercises inthis chapter:1. Open the Person class in Studio.2. Choose Class > Override.3. Select %OnGetPropertyInfo and click OK.Studio adds a skeleton %OnGetPropertyInfo method to the class.4. Edit the method as follows:178 <strong>Using</strong> <strong>Zen</strong> <strong>Components</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!