Creating
IQD Files
Copyright
Cognos Series 7 Version 2
This edition published 2003.
Copyright (C) 2003 Cognos Incorporated.
The Cognos products referenced in this documentation are copyrighted and all rights are
reserved. See the individual products' copyright notices for details.
Cognos, the Cognos logo, Axiant, COGNOSuite, Cognos Upfront, Cognos
DecisionStream, Impromptu, NoticeCast, PowerCube, PowerHouse, PowerPlay,
Scenario and 4Thought are trademarks or registered trademarks of Cognos Incorporated
in the United States and/or other countries. All other names are trademarks or registered
trademarks of their respective companies.
While every attempt has been made to ensure that the information in this document is
accurate and complete, some typographical errors or technical inaccuracies may exist.
Cognos does not accept responsibility for any kind of loss resulting from the use of
information contained in this document.
This document shows the publication date. The information contained in this document is
subject to change without notice. Any improvements or changes to either the product or
the document will be documented in subsequent editions.
U.S. Government Restricted Rights. The software and accompanying materials are
provided with Restricted Rights. Use, duplication, or disclosure by the Government is
subject to the restrictions in subparagraph (C)(1)(ii) of the Rights in Technical Data and
Computer Software clause at DFARS 252.227-7013, or subparagraphs (C) (1) and (2) of
the Commercial Computer Software - Restricted Rights at 48CFR52.227-19, as
applicable. The Contractor is Cognos Corporation, 67 South Bedford Street, Burlington,
MA 01803-5164.
Table of Contents
1.
PURPOSE ...............................................................................................................................5
2.
IMPROMPTU QUERY DEFINITIONS .....................................................................................5
2.1
How IQD files are Used to Access a Data Source..........................................................5
2.2
Example .iqd file ..............................................................................................................5
3.
CREATE AN IMPROMPTU QUERY DEFINITION MANUALLY ............................................6
3.1
Set Up Access to a Relational Data Source ...................................................................6
3.2
Create an .iqd File ...........................................................................................................7
4.
BUILD A MODEL BASED ON A MANUALLY CREATED IQD FILE.....................................7
4.1
Steps ...............................................................................................................................7
4.2
Example ..........................................................................................................................8
Creating IQD Files
iii
1. Purpose
This document describes how you can
• Create an Impromptu Query Definition (.iqd) file without using Impromptu
• Build a model based on a manually created .iqd file
2. Impromptu Query Definitions
An .iqd file is typically created by Impromptu and contains the definition for a database query.
PowerPlay Transformer can access relational data sources via Impromptu Query Definition files.
If Impromptu is not available, you can manually create an .iqd file to provide access to relational
data sources.
2.1 How IQD files are Used to Access a Data Source
An Impromptu Query Definition describes a source table from a Data Source. When you create a
model in Transformer, the contents of the .iqd file are stored in the model and the embedded .iqd
contents are refreshed when the data source is opened (that is, when you generate categories or
create cubes). The .iqd contents are also refreshed when you click OK on the Data Source
property sheet. Input values are retrieved from a supported database by executing an SQL query
that is stored in the .iqd file. For PowerPlay users to drill through to detail values, users with
ReportNet can specify a drill-through path to a ReportNet report.
2.2 Example .iqd file
The following example .iqd file includes the logical database name (HRFACT8) and the SQL
statement that defines the query. The column names that Transformer will use are appended at
the end.
COGNOS QUERY
STRUCTURE,1,1
DATABASE,HRFACT8
BEGIN SQL
{select T1."COMPANY" as c1,
T1."COMPANY_SID" as c2,
T1."DESCR" as c3,
T1."DESCRSHORT" as c4,
T1."COUNTRY" as c5,
T1."ADDRESS1" as c6,
T1."ADDRESS2" as c7,
T1."ADDRESS3" as c8,
T1."ADDRESS4" as c9,
T1."CITY" as c10,
T1."HOUSE_TYPE" as c11,
T1."COUNTY" as c12,
T1."STATE" as c13,
T1."POSTAL" as c14,
T1."GEO_CODE" as c15,
T1."PAYGROUP" as c16,
T1."CURRENCY_CD" as c17,
T1."BUSINESS_DESCR" as c18,
T1."LOCATION" as c19
from "HRFACT8"."D_COMPANY" T1}
END SQL
Creating IQD Files
5
COLUMN,0,Company
COLUMN,1,Company Sid
COLUMN,2,Descr
COLUMN,3,Descrshort
COLUMN,4,Country
COLUMN,5,Address1
COLUMN,6,Address2
COLUMN,7,Address3
COLUMN,8,Address4
COLUMN,9,City
COLUMN,10,House Type
COLUMN,11,County
COLUMN,12,State
COLUMN,13,Postal
COLUMN,14,Geo Code
COLUMN,15,Paygroup
COLUMN,16,Currency Cd
COLUMN,17,Business Descr
COLUMN,18,Location
3. Create an Impromptu Query Definition Manually
You can manually create an .iqd file using Notepad or another text editor.
3.1 Set Up Access to a Relational Data Source
Before you manually create an Impromptu Query Definition, you must set up access to a
relational data source.
Access to a relational data source is achieved by setting up a data source in Access Manager.
The Access Manager Administrator Guide provides details describing how this is achieved,
however, the basic steps are provided below.
Data sources represent network locations where data is stored. Access Manager only stores
connection information for each data source, not the contents of the data source. Access
Manager also enables you to provide auto-access to password-protected databases for users.
With an auto-access signon, users can access a database without being prompted for a database
user ID or password.
Before users can access a database, you need to define the database in Access Manager and
then give the required users access privileges to that database. Defining a database involves
• Referencing the database
• Defining the connection string so that the client application can connect to the database
You can create auto-access signons for databases. For more information, see "Set Up AutoAccess for a Database" in the Access Manager Administrator Guide.
Steps
1. Log on to a namespace. For more information, see "Log On to a Namespace" in the Access
Manager User Guides.
2. Double-click the namespace to list the contents.
3. Select the Data Sources folder and from the Action menu, click Add Database.
The Database Properties dialog box appears.
4. On the General tab, in the Name box, type a name for the database.
6
Creating IQD Files
5. Click the Connection tab.
6. In the Database Type drop-down box, select the type of database you are defining.
7. To specify the connection string, click Edit.
The Edit button only appears for databases that you can edit in this fashion. If the Edit
button does not appear for the type of database you select, go to step 9.
The Database Definition dialog box appears.
8. Enter the required connection information and click OK.
9. Click OK again to close the property sheet.
3.2 Create an .iqd File
1. Ensure you have set up access to a relational data source, as described in the previous
section.
2. Copy and paste the following text into your text editor and replace “NAME” with the logical
name you gave your database when you set up the connection in Access Manager.
COGNOS QUERY
STRUCTURE,1,1
DATABASE,NAME
BEGIN SQL
{use this type of brackets and enter your native SQL statement in between them}
END SQL
COLUMN,0,Column Name
COLUMN,1,Column Name
COLUMN,2,Column Name
COLUMN,3,Column Name
…etc for each column
3. Replace “enter your SQL statement here” with native SQL that defines your database query.
4. Ensure that there are curly {} brackets around your SQL statement.
Note: Native SQL must be used to define the database query. The SQL statement must be
encapsulated in {} brackets in order to be passed through Cognos’ Universal Data Access
(UDA) component to the database.
5. Replace Column Name for each column to provide a user-friendly name for each of the
columns that will be returned by your SELECT statement.
6. Save the resulting text to your desired location with an .iqd file extension.
4. Build a Model Based on a Manually Created IQD File
You can use Transformer to build a model based on an .iqd file that was created manually.
If you have the Transformer UNIX Edition installed, you can use .iqd files from UNIX servers. The
server connection information on the client computer must match that on the server, or else
Transformer on Unix will not be able to read the database. Transformer embeds .iqd files that are
used as data sources in the model. As a result, Transformer on Unix can query the server
database when it receives model information from Transformer on Windows.
4.1 Steps
1. Set up the data source in Access Manager as described above.
Creating IQD Files
7
2. In a text editor, define your database name and SQL query to conform to the .iqd formatting
provided and save it as an Impromptu Query Definition (.iqd) file.
3. Right-click the Data Sources list and select Insert Data Source to open the New Data Source
wizard.
4. In the Data Source Name box, type a name for the new source.
5. From the Source Type box, select Impromptu Query Definition.
6. In the Local Data File box, type the file name of the .iqd file.
7. Accept the default Isolation Level or specify an alternative, then click Finish.
The following Transformer message appears:
Database Signon <NAME> wasn’t found on the local machine. Do you want to try to
find it in Access Manager.
8. Select Yes to look in Access Manager for the Database connection information.
4.2 Example
Some of the data required for a sales-tracking model is stored in an Oracle database on a UNIX
server. You have defined the Oracle database in Access Manager and have created an .iqd file
that references that database name and you specify an SQL statement to query the ORDERS
and ORDER_DETAILS tables, and save the text as an .iqd file. Transformer can then use the
information in the file to access data from the Oracle database. After you add the .iqd file to the
Data Sources list, Transformer accesses data directly from the server when generating
categories and creating cubes.
8
Creating IQD Files