Create Form Browser

In the next Step we need to create the two forms we need.

Anything that is visible at runtime uses this approach.

 

 

We need these two types of forms:

1. Browser Form

2. Edit Form

 

1. Create Browser Form

Use Menu "File - New"

"DataWindow"

All Browser Forms will have the type "Grid"

Now we need to create the SQL Statement. The form is working with data from a database so we need to tell the form how this data is composed and where to get it from.

 

Please use "SQL-Select"

 

Select table "beamst_color" and choose "all fields"

 

We decided that we want an input field on the status bar of the browse form.

This input field will ensure that we just load particular data.

Therefore we need a retrieval parameter which we call "eingabe"

 

Use "Design - Retrieval Arguments"

Name: Eingabe

Type: String

 

In order to uses this Retrieval Argument you need to extend the SQL - Select with the following Statements

 

databrowse1

 

Now the SQL-Select will only fetch particular rows.

 

Remark:

A Form exists out of a datastore (PowerBuilder Component) (SQL-Statement, procedure or external fields ) and a form template which access this datastore.

Simply said, the datastore is a wrapper for the whole administration of data access (read / write / delete and field Mapping to visible Objects)

databrowse2

 

Leave the SQL-Painter with Return:

databrowse3

 

 

The following Wizard pages can be used with the default values. Please use "next" until the wizard closes.

 

Setup Form designer

 

Now we need to take care about binding the Database to Visual Fields ( Components in PowerBuilder)

For the first step we need to set some default values:

Menu "Design - Options"

 

 

databrowse4

 

Please use this given values and press OK.

 

Form structure

The form defines which SQL Columns will be mapped into visual components.

Now use following defaults:

Font size must be 8 Points

Font must be Arial or Tahoma

BeasCommon will ignore anything else because its Engine takes care about color management, font size and font type.

 

databrowse5

 

Font size settings:

Mark all objects. e.g. Strg+A

Now set the font size to 8

databrowse6

 

 

Define Form structure:

The SQL-Statement will return certain columns. Powerbuilder already mapped these return values already.

Please delete following objects:

erfstamp

erfuser

andstamp

anduser

Now design the Browse Form as you see above.

 

 

Define fields:

Powerbuilder mapped all the SQL-Statement values to Input fields because it assumes that we also want to update data with this form.

But we want to use this Form only as a browse form so we need to set this input fields to read only !!

 

Powerbuilder assumes that all fields that have a Tab Stop > 0 are Input Fields.

So we set the input fields Tab Stop property to 0.

Do this by click the Tab Stop icon. PowerBuilder will change into the Tab Stop Modus.

 

databrowse7

 

Also BEASCOMMON uses its own recognition Engine. All fields ( e.g. colorid ) that have a Background Color value of White are Input fields.

 

You will leave the Tab Stop Modus If you click the Tab Stop icon again.

 

Merge Form with BEASCOMMON

All BEASCOMMON Forms need to have following fields:

t_master        -> any content but need to be minimal 5 letters e.g. "abcde"

 

Remark: you can place this field anywhere in the form. But we would suggest to out in somewhere in the detail part.

 

The internal Engine of BEASCOMMON only accepts forms with these settings as a BEASCOMMON form.

Therefore any Form without that field can't be used

 

databrowse8

 

 

We need to save this Form as a .PSR file. We only used PowerBuilder to generate this Form.

Please use "File -Save as File" and choose the folder we just created "Mustermann" under Projects" with the name "mycolor_browse"

 

Now close the Window inside PowerBuilder. PowerBuilder want to save this Form now but we already did that so cancel it.