This article is Part 3 of a series called Advanced Attribute Manipulation. You can find Part 1 which describes a few functions used to check if attributes exists and how to check their type HERE. And Part 2 about useful functions that looping through an attribute dimension and perform tasks with a subset HERE.

Our topic for Part 3 of the series is to describe a way to populate data into attributes. Populating attribute values from a data source is a common task needed/done in PA. The challenge sometimes comes when our data source contains duplicate alias values.

Say we have the following sample data source in .txt format where two elements (10400 and 10500) have the same would-be alias value (i.e., a duplication of alias for two different elements).

If we only use the CELLPUTS function by itself in the data tab of a TI process to populate an alias attribute, like this:

 

 

we would get an error for that TI process.

A note on errors when loading duplicate alias values: these errors are sometimes random in PA. The error above says Cell type is consolidated, but that’s not the issue, the issue is a duplicate alias name. Sometimes you also que the error “Not a number”.

So, to avoid getting this error we can setup the loading of the alias with two conditional statements

  1. We use the CELLGETS function to check if the element for which we are we are trying to populate an alias is blank
  2. We use the DIMX function to check if the alias does not exist elsewhere in the dimension

If these conditions are true then the alias will be populated using the CELLPUTS function, if not, the source element will be output to text for further review using the ASCIIOUTPUT function.

In our example, the output file will contain the line below because, given the ordering in the source file, it’s the last element which has the duplicate alias.

This method can be used to trap errors and audit source data when we try to populate alias element names to a dimension element.