Tips_tutorials   >   Studio101   >   Introduction

Introduction

Welcome to the Studio 101 tutorial.

The Studio 101 tutorial is the first in a series of tutorials which take you step by step through writing an application using Omnis Studio. Along the way you will create and learn about, SQL database server tables, schema classes, table classes, windows, complex grids, reports, query classes, superclasses and subclasses, error handler object, headed lists, subwindows, and lots more.

This Studio 101 tutorial assumes that you have very little prior experience with Omnis Studio or writing notation in Omnis Studio, and that you have very experience with SQL (Structured Query Language). Each of the Studio 100 series tutorials builds on the next, so you need to go through them in order.

In this tutorial you will:

  1. Create a new library.
  2. Use the SQL Brower to create a new database and open a session with the database.
  3. Create a schema class and use it to create a table in the database.
  4. Create tables in the database using SQL.
  5. Insert records into the database using SQL.
  6. Open a session with the database using a session object and notation in the startup task.
  7. Create a menu class and open it from the startup task.
  8. Create a table class, add custom methods to fetch records, set primary keys, and override the Omnis Studio built-in $dowork method.
  9. Create a window class with a complex grid for entering and editing records.
  10. Create a report class and print a report of the records in the database.
The Studio 101 tutorial is provided to free to Omnis Studio developers. The Studio 102, 103, ... tutorials are free to StudioTips Members only. If you are not currently a StudioTips Member I encouage you to visit
www.studiotips.net and become a StudioTips Member. The cost of membership is minimal and covers the time and expense of creating these tutorials, providing additional demos and utilities, and maintaining the studiotips.net website.

Conventions Used in this Tutorial

As stated in the introduction, the Studio 101 tutorial assumes that you have very little prior experience with Omnis Studio or writing Omnis notation, and that you have very little experience with SQL (Structured Query Language).

To follow the code in this tutorial you will need to print and review the Naming Conventions page found on the studiotips.net website.

Every developer has their own naming conventions. Feel free to use your own, or adopt some or all of the naming conventions which I use. The naming conventions which I use have been influenced by Steve McConnell's excellent book, Code Complete. I recommend that you order a copy of Code Complete from Amazon and read it. Code Complete is a must read for programmers.

Here are some examples of naming conventions that you need to know as you look at the code in this tutorial.

I have tried to comment the code well enough to make it easy for you to follow. If there are places where you would like to see more comments or details, please send an email doug@vencor.ca If you are confused, chances are that others will be as well. You'll be doing those that follow you a favor by getting me to clarify things better in the tutorial.

If you see any typos, grammar errors, or code errors, please send me an email specifying the error and the section where it is found so that I can correct it for future users of this tutorial.

Special font styles have been used in the on-line version of this tutorial to help you.

Special paragraphs appear as follows:

Note

This is something you should note.

Tip

This is a helpful tip.

Warning

This is a warning.

; This would be a block of code.
; Though in this case there isn't any code in this block.

A series of steps will often be abbreviated as follows:

F2 Browser > Contacts > double-click sCountry

In expanded form, the above line would read, "Press the F2 function key to open the Studio Browser window, select the Contacts library, then double-click the sCountry schema class."

The backslash (/) character is used as the file path delimiter. (eg. Desktop/Contacts/data/ContactData.df1) You would replace the backslash with the applicable file path delimiter for the platform you are working on.

The F6 Property Manager window allows to you to view and edit various properties. The properties are listed in lower case. In Omnis notation the property names are prefixed with the $ character. e.g. The window title property is $title. Property names in this tutorial always include the $ prefix.

Glossary

RDBMS - Relational Databse Management System

SQL - Structured Query Language

StudioTips - A set of Omnis Studio libraries which provide additional details, code samples, tips, and warning for Omnis Studio developers.

StudioWorks - A framework written in Omnis Studio for rapid application development.

StudioTips Browser

If you are a StudioTips member you should have a copy of the tipsStudio101.lbs library in your studiotips/docs folder. All of the code in this tutorial is available to you in the tipsStudio101 library.

You will also have the completed Studio 101 tutorial in the studiotips/tutorial/Contacts folder. The library file name is Contacts101.lbs.

You can access the code in this tutorial, and copy and paste it to your Contacts library as follows:

  1. Open the StudioTips Browser window.
  2. Select the Studio 101 Tutorial in the group selector droplist at the top left corner of the StudioTips Browser window.
  3. Each of the sections in this tutorial will be listed in the treelist.
  4. When you click on a node in the treelist the topic text is displayed to the right of the treelist.
  5. If a topic includes code a Sample Code button will appear at the bottom of the StudioTips Browser window. Click the Sample Code button to open the sample code in the method editor window.
  6. Copy the sample code to the clipboard.
  7. Close the method editor.
  8. Go the the applicable class and method in your library and paste the code into your method.
I do encourage to begin this tutorial with writing the code yourself. The process of entering the variables and manually typing the code increases your learning.

Personal Biases

Everyone has certain biases when it come to programming so it is best that I tell you my biases.

  1. The Omnis data file is a decent SQL learning tool and useable for single user applications. If you get into multi-user applications or mission critical data you should move to a real RDBMS (Relational Database Management System). The good news is that Omnis Studio makes it very easy to connect your application to different RDBMSs.
  2. I prefer to use Omnis notation rather than the Omnis Omnis commands. Notation might seem harder to write, but it is much more flexible and powerful that the Omnis Omnis commands. Once you start to understand the syntax of Omnis notation is gets easier to follow and write. I am not speaking against the Omnis Omnis commands and wouldn't get into an argument over which is better. Notation is my personal bias.
  3. I only use SQL for communicating with the Omnis data file. You could use Omnis Omnis commands (Open data file, Set main file, Prepare for insert, Update files,...) but that marries you to the Omnis data file, excluding other RDBMSs. Using SQL exclusively is my personal bias.
  4. I believe in the power of community and therefore promote StudioWorks. The vision of StudioWorks is to build a community of highly effective Omnis Studio developers who benefit from each by working together on a common framework. The StudioWorks framework is a set of libraries that include a host of classes and code which is commonly used for writing custom software applications in Omnis Studio. The StudioWorks framework source libraries are completely open to StudioWorks members. You will hear me talk about StudioWorks in these tutorials. It is something I believe in, so I can't help but talk about it from time to time. Hope you'll understand.