Attrput and ElementAttributes Cube

Post Reply
MarenC
Posts: 54
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Attrput and ElementAttributes Cube

Post by MarenC » Mon Sep 02, 2019 12:55 pm

Hi,

I noticed some errors in the message log, which read Cell type is consolidated.

I checked the elements and they were simple.

The error occurred on a line with the following code:

CellPutS(vName,'}ElementAttributes_Employee',vEmp, vAttrName);

Puzzled, I then decided what would happen if I changed the above code to,

Attrputs(vName, 'Employee', vEmp, vAttrName);

which changed the error to Attribute is Not Unique, which in fact was the correct error message.

Has anyone noticed this behaviour before? And would that be a reason to use Attput rather than refer to the }ElementAttributes Cube?

Maren

lotsaram
MVP
Posts: 3328
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Attrput and ElementAttributes Cube

Post by lotsaram » Mon Sep 02, 2019 1:22 pm

For sure sometimes the error message returns can be misleading.

If using AttrPutS to an alias and the string is the same as the principal name then the value won't be stored, versus with CellPutS it will be. I guess this was benefoicial in the bad old 32 bit days where every byte of memory was precious. Also if using AttrPutS you can avoid the error you are experiencing without any additional coding by using an optional true/false enforceUnique argument which will automatically concatenate the principal name to the end of the string should the value be ambiguous.
e.g. AttrPutS( stringValue, cDimTgt, vEleTgt, sAliasName, 1 );
(you only want to use this argument for alias type attributes)
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

MarenC
Posts: 54
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Attrput and ElementAttributes Cube

Post by MarenC » Mon Sep 02, 2019 1:54 pm

Hi and thanks for the reply
enforceUnique argument which will automatically concatenate the principal name to the end of the string
Looking at the IBM guide, it says this argument is LangLocaleCode, nothing about enforceUnique?

Maren

lotsaram
MVP
Posts: 3328
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Attrput and ElementAttributes Cube

Post by lotsaram » Mon Sep 02, 2019 6:22 pm

This argument is undocumented (but widely known and used). It comes before the locale code.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

Wim Gielis
MVP
Posts: 2278
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1
Version: PAL 2.0.8
Excel Version: Office 365 - latest
Location: Brussels, Belgium
Contact:

Re: Attrput and ElementAttributes Cube

Post by Wim Gielis » Tue Sep 03, 2019 9:14 am

lotsaram wrote:
Mon Sep 02, 2019 6:22 pm
This argument is undocumented (but widely known and used). It comes before the locale code.
I did not know this function argument, thanks for that.
Best regards,

Wim Gielis

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 109 TM1 articles and a lot of custom code
Newest blog article: Set up a TM1 model with AutoHotKey as a service or application

Catherine
Posts: 108
Joined: Wed May 20, 2009 7:30 am
OLAP Product: TM1
Version: 10.2.2 - PA
Excel Version: 2010
Location: Rennes, France

Re: Attrput and ElementAttributes Cube

Post by Catherine » Mon Nov 25, 2019 9:47 am

lotsaram wrote:
Mon Sep 02, 2019 6:22 pm
This argument is undocumented (but widely known and used). It comes before the locale code.
Thank you, I didn't know this argument either.

I have another question related to AttrPutS function. What is the last parameter LangLocalCode ? What is the utility of this parameter ? I couldn't find anything I could understand !

lotsaram
MVP
Posts: 3328
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Attrput and ElementAttributes Cube

Post by lotsaram » Mon Nov 25, 2019 12:14 pm

Catherine wrote:
Mon Nov 25, 2019 9:47 am
I have another question related to AttrPutS function. What is the last parameter LangLocalCode ? What is the utility of this parameter ? I couldn't find anything I could understand !
Using a locale code in AttrPutS will update the value against the attribute / locale pair in the }LocalizedElementAttributes_DimName cube. (Or if the cube doesn't exist it will be created automatically).

When using modern locale aware UIs (like PA Workspace) the localized attribute value will automatically be requested. If there is no localized attributes cube, or if the localized value is empty, then the base attribute value will be returned and displayed to the user.

There is also a }LocalizedCubeAttributes and }LocalizedDimensionAttributes cube(s) which hold local variants of the Caption attribute which can be used to customize the object names displayed to users based on their language preference (as defined by their browser settings).

In the old days we would have created separate attributes per language for global applications and used a user preference cube and excel formula tricks to switch display language. It's much easier now as the UI itself does all the heavy lifting. All the developer needs to do is populate the local attribute values.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

Catherine
Posts: 108
Joined: Wed May 20, 2009 7:30 am
OLAP Product: TM1
Version: 10.2.2 - PA
Excel Version: 2010
Location: Rennes, France

Re: Attrput and ElementAttributes Cube

Post by Catherine » Mon Nov 25, 2019 2:49 pm

Tanks Lotsaram for the explanations.
It is very interesting.

I was able to find the list of TM1 clients that support localization in 10.2.2:
"The following TM1 clients support localization:
IBM Cognos TM1 Web
IBM Cognos TM1 Application Web
IBM Cognos Insight
IBM Cognos Analysis for Microsoft Excel"

But I don't manage to find the equivalent list for PA. You talked about PA Workspace. What about PA for Excel ? Does it support localization ?

Wim Gielis
MVP
Posts: 2278
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1
Version: PAL 2.0.8
Excel Version: Office 365 - latest
Location: Brussels, Belgium
Contact:

Re: Attrput and ElementAttributes Cube

Post by Wim Gielis » Mon Nov 25, 2019 2:53 pm

Yes to both
Best regards,

Wim Gielis

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 109 TM1 articles and a lot of custom code
Newest blog article: Set up a TM1 model with AutoHotKey as a service or application

Post Reply