Example: Adding attributes to an existing view or table in a data model
You can add attributes to an existing view or table in a data model by using the following example.
The following example procedure shows how to add an item to an existing view in the IBM® Cognos® model. For this example, assume that you need to add a custom offer attribute to the Campaign database and then include it in a report. You have already completed the following tasks:
*
Created the offer attribute in the UA_OfferAttribute table.
*
*
*
Ran the generated script in the Campaign database to update the Offer Custom Attribute reporting view, UARC_OFFEREXTATTR.
Now, to add the new offer attribute to the Cognos® Campaign model, you would complete the following steps.
1.
Make a backup of the Campaign model. That is, navigate to the Cognos/models directory and copy the CampaignModel subdirectory. In a distributed Cognos® environment, the models directory is in a location on the system running the Content Manager.
2.
In Framework Manager, open the Campaign.cpf file (the project) and expand the Import View node.
3.
Under Import View, select the query object that represents the reporting view for custom offer attributes: Import View > Campaign Custom Attributes > UARC_OFFEREXTATTR.
4.
Select Tools > Update Object. Cognos® refreshes the columns listed under the node for the view so they reflect all the columns currently present in the UARC_OFFEREXTATTR reporting view in the Campaign database.
5.
Expand the Model View and select the node that represents custom offer attributes in this view: Model View > Campaign Custom Attributes > Offer Custom Attributes.
6.
Double-click the Offer Custom Attributes node to open the Query Subject Definition dialog box.
7.
Locate the new column and add it to the Model View. Then edit the name of the query item so it can be read easily. For example, the column named LASTRUNDATE in the Import View of the Campaign data model appears as Last Run Date in the Model View.
*
Because the Business View contains a shortcut to the Offer Custom Attributes node in the Model View, the new query item now available in the Business View without your having to add it manually.
8.
9.
Publish the package to the Cognos® content store.
Now you can add the attribute to the appropriate report using IBM® Cognos® Report Studio.