To create a form for a print session

When you create a print session, you must also create the form for the session.

The form is used to specify selection ranges and processing options:

  • Selection ranges specify a lower and upper range. Ranges are typically used for key fields or alternate key fields. The fields that are inserted on the form need to correspond to the program script variables that are used in the main SQL statement that selects rows from the database. You can extend the SQL statement to add additional range variables.
  • Processing options are used to specify additional conditions for selecting rows, or for specifying the sort order. Some processing options will change the report group number so that a different report is selected automatically for the user.

For detailed information on the Dynamic Form Editor, see the Dynamic Form Editor's online help.

Before you create the form, it is helpful to review the program script. This is particularly true if you created the program script when you created the print session. The program script contains the default selection ranges.

You may have to extend the generated program script to query references to parent tables.

See this example program script:

|**********************************************************
|* cxoes0421  0  VRC B61U a  dv00
|* 
|* Development User              
|* 2005-02-07
|**********************************************************
|* Main table cxoes021 Suppliers, Form Type 4
|**********************************************************
                                                                                
|****************************** declaration section *******
declaration:

  table   tcxoes021 | Suppliers
  table   tcxoes031 | Countries

   extern  domain  cxsuno           suno.f    fixed
   extern  domain  cxsuno           suno.t    fixed

|****************************** program section ************

|****************************** group section **************
group.1:
init.group:
   get.screen.defaults()

|****************************** choice section *************
choice.cont.process:
on.choice:
   execute(print.data)

choice.print.data:
on.choice:
   if rprt_open() then
       read.main.table()
       rprt_close()
   else
       choice.again()
   endif

|****************************** field section ***************
field.suno.f:
when.field.changes:
   suno.t = suno.f

|****************************** function section ************
functions:

function read.main.table()
{
    select cxoes021.*, cxoes031.*
    from cxoes021, cxoes031
    where   cxoes021._index1 inrange {:suno.f}
                                    and {:suno.t}
    and     cxoes021.ccty refers to cxoes031
    order by cxoes021._index1
   selectdo
       rprt_send()
   endselect
}

Create the form for the print session. You can create a form in a variety of ways, this procedure shows you how a typical form is setup for a print session.

Step 1. Insert a Group

To insert a group in the form:

  1. In the Sessions (ttadv2500m000) session, select the session for which you want to create the form.
  2. Click Edit Form .... The Dynamic Form Editor starts.
  3. Insert a group for selection ranges.
Insert Group

Insert Group

Step 2. Insert Labels

Insert a label only field, with the label corresponding to “From”. Note that the position indicator is “above”.

This table shows an example of the Field Properties:

FieldInput Value
Field Namelabel.only
Use Field as Label OnlyYes
Label Codettgen.from
PositionAbove

 

Insert a second label only field with a label code corresponding to “To”. The “To” label field is a child of the from label field.

This table shows an example of the Field Properties:

FieldInput Value
Field Namelabel.only
Use Field as Label OnlyYes
Label Codettgen.to
PositionAbove

 

Insert Label Fields

Insert Label Fields

Step 3. Insert Selection Fields

The selection fields you insert on the form must correspond to the variables that are used in the main SQL statement in the program script.

Insert the "From" field corresponding to the first selection field. This field is denoted as a table field name appended with a “ .f ”.

This table shows an example of the Field Properties:

FieldInput Value
Field Namesuno.f
Use Field as Label Only
Domaincx suno
Form FieldYes, fmin($#)
Label Codeoes021.suno
PositionBefore
ZoomSession
Zoom Tocxoes0121m000
Return Fieldcxoes021.suno

 

Insert the "To" field corresponding to the first selection field. This field is denoted as a table field name appended with a “ .t ”.

This table shows an example of the Field Properties:

FieldInput Value
Field Namesuno.t
Use Field as Label Only
Domaincx suno
Form FieldYes, fmax($#)
Label Code
Position
ZoomSession
Zoom Tocxoes0121m000
Return Fieldcxoes021.suno

 

Insert Selection Range Fields

Insert Selection Range Fields

Step 4. Edit Standard Commands

Click Standard Commands on the Tools menu. The Standard Commands (ttadv3110s000) session starts. Edit the Standard Commands for the form so that these commands are available:

CommandsAvailable
Modify Record(s)Yes
Print ReportYes
CancelYes
Make JobYes (Optional)
Save DefaultsYes (Optional)
Get DefaultsYes (Optional)

 

Step 5. Save the form

Save the form.

You can view the effect of your changes from within the form editor: On the File menu, click Show Details Session. The session starts.

Form Result

Form Result

Save and Exit the form.