Working with forms

Once you have created a basic form, you can run it, import data into it, save its data in an external file, and print it. You can also assign actions to buttons you place in the form.

Running forms

You run forms to display and change information in the database. You can run a form at any time after InfoMaker has generated a basic form.

To run a form you are not currently working on:

  • Click the Preview button in the PowerBar, select the form in the Run/Preview dialog box, then click OK.

To run a form you are currently working on:

  • Click the Run button in the PainterBar.

What happens

You are now running the form. Command buttons and picture buttons you have placed in the form are now active. For information about adding controls to a form, see Enhancing Forms

Exactly what you can do when you run the form depends on the form style. It is the form style that determines the menu items that display in the menu bar and the buttons that display in the PainterBar when you run a form.

Typically when you run a form, InfoMaker retrieves the data from the database and displays it to you; then you can scroll through existing data and add, modify, and delete rows in the database.

When you change data using a form

If you change data and you do not click the Update button before closing the form, InfoMaker prompts you to save data in the database before closing the form.

For complete information about what you can do when running forms that use InfoMaker's built-in form styles, see Actions in forms.

If you need information about running forms using a style developed by a PowerBuilder user at your site, see the developer.

Limiting the retrieved data

After you run a form, you can specify criteria that limit the rows of data and cause a re-retrieval of rows.

To specify criteria to limit the data:

  1. Do one of the following:

    • Click the Criteria button in the toolbar.

    • Select Rows>Specify Criteria from the menu bar.

    InfoMaker clears all the data.

  2. Specify the criteria.

    In master/detail forms, you specify the criteria in the form's master area, which is a freeform area for master/detail one-to-many forms and a grid area for master/detail many-to-one forms. Both are like the grid you use when defining data using the Quick Select data source.

    Use expressions and operators in the blank spaces of the grid to specify criteria.

    To specify a second set of criteria in a master/detail one-to-many form, press Page Down to get a new entry form and specify the criteria in the new master area. The second set of criteria will be ORed with the first set; data is retrieved if one set or the other set is true.

    For information about expressions, see Using Quick Select, and Operators and Expressions.

  3. Do one of the following:

    • Click the Apply button.

    • Select Rows>Apply Criteria from the menu bar.

    InfoMaker retrieves rows based on the criteria.

  4. If you want to modify the criteria, repeat steps 1 through 3.

Importing data into a form

When you run a form, you can import data from a file and save it in the database.

For freeform and grid forms only

You can import data only in freeform and grid forms. You cannot import data in master/detail forms.

To import data:

  1. Select Rows>Import from the menu bar.

    The Select Import File dialog box displays.

  2. Navigate to the folder you want and select the file from which you want to import the data.

    The types of files that you can import into the form are shown in the Files of Type drop-down list.

  3. Click Open.

    InfoMaker reads the data from the file. You can view the data and save it in an external file.

Data from a file must match retrieved columns

When importing data from a file, the data must match all the columns in the retrieved data (the columns specified in the SELECT statement), not just the columns that are displayed in the form.

Saving data in an external file

When you run a form, you can save the data retrieved (and optionally the headers) in an external file.

To save data in an external file:

  1. Select File>Save Rows As from the menu bar.

    The Save As dialog box displays.

  2. Choose a format for the file from the Save As Type drop-down list.

    When you choose a format, InfoMaker supplies the appropriate file extension.

    If you want the column headers saved in the file, select a file format that includes headers, for example Excel With Headers. When you select a with headers format, the names of the database columns (not the column labels), are also saved in the file.

    Saving the data as a Powersoft report or HTML table

    Choose Powersoft report in the Save As Type box to save the data as a Powersoft PSR file. Choose HTML Table in the Save As Type box to save the data as an HTM file.

    For information about PSR files and about working with files saved as HTM files, see Enhancing Reports

  3. Name the file.

  4. Click Save.

    InfoMaker saves all rows in the file; all columns in the rows are saved.

Printing forms

Although forms are primarily used for data entry, after you run a form, you can print it. Printing a freeform form is particularly helpful because each page displays the data one row at a time.

To print a form:

  • Do one of the following:

    • Select File>Print from the menu bar.

    • Add a command button to a form, associate the print action with the button, and click the button.

    For information about adding a command button and associating an action with a button, see Enhancing Forms.

Actions in forms

You can assign the actions in the following table to buttons you place in a form. Many actions are also available in the toolbar and menu when you run a form.

Because all data is visible in Grid style forms, there are no First, Last, Next, and Prior buttons/actions as there are in the Freeform, Master/Detail One-To-Many, and Master/Detail Many-To-One styles.

For information about placing buttons in a form, see Enhancing Forms.

Action

Menu item

What the action does

Form styles available in

Apply_Criteria

Rows>Apply Criteria

Validates the selection criteria, then re-retrieves the rows based on the criteria

All

Cancel_Updates

Rows>Cancel Changes

Discards changes made since the last update

All

Clear_Filter

None

Clears the current filter

Freeform, Grid

Clear_Detail_Filter

None

Clears the detail filter

Master/Detail One-To-Many, Master/Detail Many-To-One

Clear_Master_Filter

None

Clears the master filter

Master/Detail One-To-Many, Master/Detail Many-To-One

Close

File>Close

Closes the form (in the InfoMaker environment, returns you to design mode)

All

Delete_Row

Rows>Delete (Ctrl+D)

Deletes the current row in the form

All

Filter_Dialog

None

Displays the Filter dialog box for defining a filter

Freeform, Grid

Filter_Detail_Dialog

None

Displays the Filter dialog box for defining a filter for the detail part of the form

Master/Detail One-To-Many, Master/Detail Many-To-One

Filter_Master_Dialog

None

Displays the Filter dialog box for defining a filter for the master part of the form

Master/Detail One-To-Many, Master/Detail Many-To-One

First_Row

Rows>First

Scrolls to the first retrieved row (in the master area)

Freeform, Master/Detail One-To-Many

Import_File

Rows>Import

Displays the Select Import File dialog box to select a file for importing rows of data

Freeform, Grid

Insert_Row

Rows>Insert (Ctrl+I)

Inserts a new row (in the master area) and scrolls to it with the cursor in the first column

All

Last_Row

Rows>Last

Scrolls to the last row in the form (in the master area)

Freeform, Master/Detail One-To-Many

Next_Row

Rows>Next

Scrolls to the next row

Freeform, Master/Detail One-To-Many

Print

File>Print

Prints the retrieved data

All

Print_Dialog

None

Displays the Windows Print dialog

Freeform, Grid

Print_Setup

File>Print Setup

Opens the Windows Printer Setup dialog box allowing you to change the printer or its settings

All

Prior_Row

Rows>Get Prior

Scrolls to the previous row in the master area

Freeform, Master/Detail One-To-Many

Retrieve

Rows>Retrieve

Retrieves rows from the database and prompts you for criteria if Prompt for Criteria was specified in the workspace

All

Save_As

File>Save Rows As

Saves rows of data in a selected file format, including text format or a Powersoft report

Freeform, Grid

Sort_Dialog

None

Displays the Sort dialog box for defining sorting

Freeform, Grid

Sort_Detail_Dialog

None

Displays the Sort dialog box for defining sorting for the detail part of the form

Master/Detail One-To-Many, Master/Detail Many-To-One

Sort_Master_Dialog

None

Displays the Sort dialog box for defining sorting for the master part of the form

Master/Detail One-To-Many, Master/Detail Many-To-One

Specify_Criteria

Rows>Specify Criteria

Updates the database, then clears the form to allow you to specify selection criteria for the rows

For information, see Limiting the retrieved data

All

Update_Row

Rows>Update

Updates the current row in the database

Freeform

Update_Rows

Rows>Update (Ctrl+U)

Updates all modified rows in the database

Grid, Master/Detail One-To-Many, Master/Detail Many-To-One


Accessing and deleting forms

To access a form:

  1. Click the Open button in the PowerBar.

    The Open dialog box displays:

  2. If necessary, select Forms in the Object Type box.

  3. Highlight the form you want in the list and click OK.

  4. The form displays in Layout view in the Form painter. You can work on the design of the form there.

    For more information, see Enhancing Forms.

  5. Click the Run button to run the form.

    When you run a form, InfoMaker retrieves data from the database and displays the form so that you can view and change information in the database. For more information, see Running forms.

To delete a form: