2. Generating an Application from a Model
Genero Studio video scripts
Related video: 2. Generating an Application from a Model
In this video, I’ll guide you step by step to generating a fully functional Genero application using the Business Application Modeling tool in Genero Studio.
Step 1: Create a Managed Project
The first step is to create a special project used for BAM projects. It’s called a managed project. Managed projects automatically contain the additional build rules for creating the generated programs.
Use the Studio main menu option File>>New, Design, Managed Project (.4pw) to create a project for your application.
The project structure has three pre-defined nodes, to contain the files for your project:
- Application – for the program and form files, and any additional source code files
- Databases – for the Genero database schema files
- Library – for any additional resource files
If I right-click on the Application node and select Advanced Properties from the menu, I’ll see that the dependencies for the Databases and Library nodes have been set, insuring that any files they contain will be included in your application.
Next, I’m going to add an additional fglprofile file to my FGLPROFILE environment variable list because this fglprofile file contains the configuration information to access the sample databases and I’m planning to use officestore, one of the sample databases that comes installed with the product.
I select Environment Variables in the Pages list, and add a User variable FGLPROFILE by clicking on the green cross. This file is located in the Documents and Settings//My Documents/My Genero Files/samples/DSConfig directory.
Now I’ll save the project to a folder in my file system.
Step 2: Design the global flow with the Business Application Diagram (.4ba)
Now that I have my project ready, I’m going to design the global flow of my application with the Business Application diagram by creating a new 4ba file.
Use the Studio main menu option File>>New, Design, Application Modeling, Business Application Diagram (.4ba) to create a blank diagram.
I want to create a simple application that xxx, so I’ll lay out my design with a Program, a Form, a Zoom Form and a Report since I know this application will at least have these components. I can come back and change or add to this diagram at any time.
Now, I’ll set the relationship between the components by right-clicking and drawing out the arrows to show the relationships. My program will be calling the form and the form will call both the zoom form and the report.
Step 3: Add the Database Schema (.4db)
The next step is to add the database schema from which this application is based. The schema is extracted from your database by using the xxx process. Since we are using the sample officestore database, I’m going to pull in the schema for this database that is already available.
The meta-schema manager shows me the database tables and columns and some properties and relationships. I can add additional meta data to this diagram such as the default widget to be used when a field is used on a form. I also can make sure that there is a unique key marked for each table if that information was not gleaned from the database when the schema was created.
Step 4: Implement the Program and Form objects on the BA Diagram
Now I’m ready to implement the objects on my BA diagram.
I’ll right-click on the Program icon and select Implement Program. When the Save As dialog appears, assign a name for the program file, and save it under the Application node. This file will be used to generate the source code for the main function of the program. The file will be .4prg.
Next, I’ll right-click on the Form icon and select Implement Form from Database to generate a form for the database table that I want this form to access. I’m going to select the officestore database, the account table and the first ten fields of the table from the Table List.
I’ll Finish and save the form (.4fdm) to the project structure under the Application node.
Now you have two documents in your Central work area, the Application Diagram (.4ba) and the Form Definition (.4fdm).
I can go ahead and build and execute the program. I do not have to implement the other objects on my diagram yet. Let’s see what we have at this point as nothing else is required!