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:
- Create a new library.
- Use the SQL Brower to create a new database and open a session with the database.
- Create a schema class and use it to create a table in the database.
- Create tables in the database using SQL.
- Insert records into the database using SQL.
- Open a session with the database using a session object and notation in the startup task.
- Create a menu class and open it from the startup task.
- Create a table class, add custom methods to fetch records, set primary keys, and override the Omnis Studio built-in $dowork method.
- Create a window class with a complex grid for entering and editing records.
- 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.
- Lower case i variable prefix indicates an instance variable. (iList, iTitle)
- Lower case c variable prefix indicates an class variable. (cDateFrom, cDateTo)
- Lower case p variable prefix indicates a parameter variable. (pDateFrom, pDateTo)
- Absense of a lower case i, c, or p variable prefix indicates a local variable. (List, Title, DateFrom, DateTo)
- Lower case r in the variable prefix indicates an item reference type variable. (irButton, rWin, prWin)
- Lower case b in the variable prefix indicates a boolean type variable. (bShowActive, ibShowActive, pbShowActive)
- Variable with the word List in the variable name indicates a list variable. (iList, pList, CountriesList)
- Variable with the word Row in the variable name indicates a row variable. (iRow, pRow
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.
- Text which you have to enter looks like this.
- File names, folder names, and path names look like this.
- Library names, class names, method name, and code looks like this.
- Menu names, button names, window titles, button names look like this.
- Words with extra emphasis look like this.
- Words with strong emphasis look like this.
Special paragraphs appear as follows:
This is something you should note.
This is a helpful tip.
This is a warning.
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:
- Open the StudioTips Browser window.
- Select the Studio 101 Tutorial in the group selector droplist at the top left corner of the StudioTips Browser window.
- Each of the sections in this tutorial will be listed in the treelist.
- When you click on a node in the treelist the topic text is displayed to the right of the treelist.
- 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.
- Copy the sample code to the clipboard.
- Close the method editor.
- 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.
- 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.
- 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.
- 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.
- 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.