13.07.2015 Views

Using Caché Studio - InterSystems Documentation

Using Caché Studio - InterSystems Documentation

Using Caché Studio - InterSystems Documentation

SHOW MORE
SHOW LESS

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

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

Building a Simple Application with <strong>Studio</strong>The sql attribute provides an SQL statement. SELECT lists the two properties fromyour PhoneBook.Person class, and FROM provides the full package and class name. This SQLquery provides the data for the .3. Save and compile the class, then view the Web page.4. Use the “New” and “Save” buttons to add more entries to the database.5. Click the browser refresh button to view the updated table. The new entries are visible.6. Remove the need for the user to refresh after each new entry, by refreshing the table automaticallyafter each save. To accomplish this, add two lines to the saveRecord method, so that it looks likethis:/// Save the current instance of the controller object.Method saveRecord() [Language = JavaScript]{var form = zenPage.getComponentById('MyForm');form.save();var table = zenPage.getComponentById('people');table.executeQuery();}7. Save and compile the class, then view the Web page. It should look like this:8. Use “New” and “Save” to add more entries to the database. Each time you click “Save,” thesaveRecord method updates the table so that the newest entry becomes visible.To learn more about Zen, see the book <strong>Using</strong> Zen.26 <strong>Using</strong> <strong>Caché</strong> <strong>Studio</strong>

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

Saved successfully!

Ooh no, something went wrong!