Create Edit-Form

Now we need to create the Edit Form for manipulating the Colors.

Remember we decided to use a browse able form for showing the data and an extra Edit form to manipulate the data.

 

The approach will be the same as before.

First of all we need to define the Datastore.

Open Powerbuilder

Create a New Datawindow with type Freeform

Create the SQL-Select  (Do not forget the t_master field !!!)

Please use the Table "beasmst_color" with all columns

 

 

Choose:

Well now we have to analyze when we plan to open the edit form.

Lets assume the we only need to show the edit window from our Browser Form.

But we need to tell the edit window what do to with what data

!! Remember we will use the edit form for a single Record manipulation !!

 

There is a Structure variable exactly for that purpose. This structure will be passed between be.as Forms.

 

The Structure looks like this:

s_parm1

string

s_parm2

string

s_parm3

string

s_parm4

string

s_parm5

string

c_parm1

decimal

c_parm2

decimal

c_parm3

decimal

c_parm4

decimal

c_parm5

decimal

b_parm1

boolean

b_parm2

boolean

dt_parm1

datetime

dt_parm2

datetime

(and some more fields but not needed for us right now)

 

One Special field of the structure is "b_parm1". If this is set to true and a form is opened, automatically a new record will be inserted and shown.

 

If we want to use a retrieval argument than we need to pass this into the structure parameter s_parm1.

This parameter will be uses as an retrieval argument.

 

So we need to ensure that the SQL-Statement in PowerBuilder - Datawindow also uses one Retrieval Argument.

 

So please use Menu "Design - Retrieval Arguments"

 

Important:

The Retrieval Argument name must be "s_parm1" like the name of the field in the Structure.

 

Now we need to enhance the SQL-Statement with an where clause.

Please insert "colorid = :s_parm1"

[Arguments need to have ":"  

In der Whereklausel colorid=:s_parm1 eintragen

Remark:

Retrieval Arguments will be marked with ":"

 

databrowseF

 

Now close the SQL-Painter with the Return-Icon to move into the DataWindow Design Editor-

databrowse3