Page 1 of 1
Attrput and ElementAttributes Cube
Posted: Mon Sep 02, 2019 12:55 pm
by MarenC
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
Re: Attrput and ElementAttributes Cube
Posted: Mon Sep 02, 2019 1:22 pm
by lotsaram
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)
Re: Attrput and ElementAttributes Cube
Posted: Mon Sep 02, 2019 1:54 pm
by MarenC
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
Re: Attrput and ElementAttributes Cube
Posted: Mon Sep 02, 2019 6:22 pm
by lotsaram
This argument is undocumented (but widely known and used). It comes before the locale code.
Re: Attrput and ElementAttributes Cube
Posted: Tue Sep 03, 2019 9:14 am
by Wim Gielis
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.
Re: Attrput and ElementAttributes Cube
Posted: Mon Nov 25, 2019 9:47 am
by Catherine
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 !
Re: Attrput and ElementAttributes Cube
Posted: Mon Nov 25, 2019 12:14 pm
by lotsaram
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.
Re: Attrput and ElementAttributes Cube
Posted: Mon Nov 25, 2019 2:49 pm
by Catherine
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 ?
Re: Attrput and ElementAttributes Cube
Posted: Mon Nov 25, 2019 2:53 pm
by Wim Gielis
Yes to both