Creating an OLE column

This section describes how to create an OLE column in a report. The steps are illustrated using a table that you can create in the Database painter. It must contain at least two columns, id and object:

StepsTo create the database table:

  1. In the Database painter, create a table to hold the blob (binary large-object) data.

    The table must have at least two columns: a key column and a column with the blob datatype. The actual datatype you choose depends on your DBMS. For example, in SQL Anywhere, choose long binary as the datatype for the blob column. For information about datatypes, see your DBMS documentation.

  2. Define the blob columns as allowing NULLs (this allows you to store a row that does not contain a blob).

Adding a blob column to the report

The following procedure describes how to add a blob column to a report.

StepsTo add a blob column to a new report:

  1. Create a new report.

  2. Specify the table containing the blob as the data source for the report.

    Be sure to include the key column in the data source. You cannot include the blob column in the data source; if you try, a message tells you that its datatype requires the use of an embedded SQL statement. You add the blob column later in the Report painter workspace. (If you use Quick Select, the blob column is not listed in the dialog box.)

  3. Select Insert>Control>OLE Database Blob and click where you want the blob column in the Design view.

    The Database Binary/Text Large Object dialog box displays:

    The sample shows the Database Binary / Text large Object dialog box.

Setting properties for the blob column

The following procedure describes the properties you need to set for the blob column.

StepsTo set properties for a blob column:

  1. (Optional) Enter the client class in the Client Class box. The default is DataWindow.

    This value is used in some OLE server applications to build the title that displays at the top of the server window.

  2. (Optional) Enter the client name in the Client Name box. The default is Untitled.

    This value is used in some OLE server applications to build the title that displays in the title bar of the server window.

  3. In the Table box, select the database table that contains the blob database column you want to place in the report.

    The names of the columns in the selected table display in the Large Binary/Text Columns list.

  4. In the Large Binary/Text Columns box, select the column that contains the blob datatype from the list.

  5. If necessary, change the default key clause in the Key Clause box.

    InfoMaker uses the key clause to build the WHERE clause of the SELECT statement used to retrieve and update the blob column in the database. It can be any valid WHERE clause.

    Use colon variables to specify report columns. For example, if you enter this key clause:

    id = :id
    

    the WHERE clause will be:

    WHERE id = :id
    

  6. Identify the OLE server application by doing one of the following:

  7. Enter text or an expression that evaluates to a string in the Client Name Expression box.

    The server might use this expression in the title of the window in the OLE server application. The expression you specify can identify the current row in the report.

    NoteUse an expression to make sure the name is unique To make sure the name is unique, you should use an expression. For example, you might enter the following expression to identify a document (where id is the integer key column):

    "Document " + String(id)
    

  8. Click OK.

    InfoMaker closes the dialog box. The blob column is represented by a box labeled Blob in the Design view.

  9. Save the report.

The following screenshot shows what a completed Definition page for a Blob object in a table called ole looks like in the Properties view:

The sample shows a completed definition page. The fields displayed are Client Class with the entry Data Window, Client Name of Untitled, Key Clause with the value i d = : id, File Template, which is blank, Client Name Expression with the entry " Document " + String ( i d ), Table with the entry D B A dot o l e, Large Binary / Text Col with the entry object : blob, and OLE Class D e s c with the entry Word dot Document dot 8 : Microsoft Word Document.

Making the blob column visible

If the blob column is invisible in the report until you activate the OLE server, you can make it easy to find the blob column by adding a border to the object.

Previewing an OLE column

Before using the report in an application, you should preview it in the Preview view or in preview mode to see how it works.