As IBM Planning Analytics (PA/TM1) developers we often find ourselves in need to manipulate attributes in a dimension. This manipulation may be with the purpose of creating said attribute or populating it with data. We assume here the manipulation will be done via the Turbo Integrator (TI) tool. So, any manual interaction with attributes is out of scope for this article. Also, there are other types of attribute manipulation available in TI. These two are the most frequently needed, accordingly, they are the ones we will focus on.

  1. The natural progression, most of the time, when working with attributes is the following:
  2. check if the attribute exists, which avoids any potential TI errors
  3. If the attribute does not exist, then create it and specify an attribute type and populate it with data

If the attribute exists, then check if the type is the correct type and populate it with data

This article is the first in a three-part series that will walk you through a few useful functions for manipulating attributes in PA using TI. The progression of steps does not need to be followed exactly; the purpose is to illustrate the options available.

Example set up:

We start with a file called AttributeData.csv, which we will use as our data source to a TI process that will update the values stored in attributes on the dimension called plan_business_unit. (This dimension lives in the Planning Sample model provided by IBM Planning Analytics’ samples, so you should be able to follow along if you have the samples running.)

We will follow the steps outlined above to check if exists, create, and populate.

Check if an attribute exists, if not, create it

If a dimension contains the list of attributes, this list of attributes is itself a dimension, thus we can use the DIMIX function to check if the attribute exists. This step is important because if the attribute does not exist then any manipulation that references it will error out.

Dimension Name: Plan_Business_Unit

Step 1: Use the DIMIX function to check if the attribute does exist, if not, then insert it using the ATTRINSERT function.

Note: More info about syntax can be found here.

Check if an attribute exists, if yes, check the attribute type

We can again use the DIMX function to check if the attribute exists, if yes, then check the attribute’s type using the DTYPE function, like this:

Please note the following characteristic of the DTYPE function: the result is different when used against elements in an attribute dimension (control object) vs a “normal” dimension.

When used for checking a control object dimension, it will return the type with an A prefix. So, the result would be:

– For Alias attributes: AA

– For String attributes: AS

– For numeric attributes: AN

When used for checking types a “normal” dimension it will return an N, S or C as shown in the example below.

The DTYPE for Europe will return C and for the UK will return N.

Example of situations when we need to check an attribute’s type can be:

– When looping through a dimension and only want to get S elements, or N elements.

– When looping through attributes and only want to get A elements

We will continue exploring attribute manipulations and functions in a Part 2 article.