Building the SQL Query

The next step is to create the SQL query. To do this, right-click on the “Capture Form” icon and select New -> CaptureForm Query. A “New Query” entry will now exist in the Process Tree.


Right-click on “New Query” to rename the query to “Get PO Number” then double click on the item to bring up the Design Window where you will enter the query.

S Q L builder. The query is set to execute before each page. This is indicated by a green flag in the Process tree. The pre flag is blue, the post flag is black, and the test flag is yellow.

The selection chosen under “Executes” determines when the query will execute during the process. This is indicated next to the query in the Process Tree with one of the colored flags in the Legends section.

Enter a query that obtains the PO number from the application’s database and store it into the PO_Number variable. For example:

select ponum
into :PO_Number
from invoices
where invoiceid = :InvID

Note: Do not enter a semicolon at the end of your SQL statement. If you are copying a query from another application that uses semicolon notation, you should make sure to remove the semicolon when pasting the query into FormFusion.

For more information, see Working with CaptureForm Queries.

Queries will execute in the order listed within the Process Tree if the same execute option is selected for multiple queries. Queries can be re-ordered within the Process Tree by right clicking the query, then selecting Move Up or Move Down.

The S Q L builder. The completed query is at the bottom, and the green test button is in the upper left corner.

Click the green test button to test the SQL script.