Page 1 of 1

Concatenating element name and attribute value in rules

Posted: Thu Aug 05, 2021 11:42 am
by vasek1192
Hi, I was wondering if it is possible to concatenate Element names and Attribute values using rules?

Example:
Concatenating.jpg
Concatenating.jpg (21.67 KiB) Viewed 4703 times

I would like to get text value : "PF - Car Manufacturing" in the alias attribute Plny_nazev.

I serached through the IBM documentation and oth this forum, but cant find combination of functions that would work. any suggestions? Thanks

Re: Concatenating element name and attribute value in rules

Posted: Thu Aug 05, 2021 11:50 am
by Elessar
Hi!

Code: Select all

'a' | 'b'
Interesting! I've tried to find it in "TM1 Reference", and didn't find it either...

Re: Concatenating element name and attribute value in rules

Posted: Thu Aug 05, 2021 12:22 pm
by Alan Kirk
AttrS will retrieve a string attribute in a rule. I would expect this to work to populate another String attribute (I've never tried it) but I'm not at all sure that a rule will (or should) work to populate an alias. The problem is that an alias needs to be a unique identifier across the principal names and all other aliases, and if it's rules generated then there is no guarantee that you won't run into conflicts. When you update a dimension with the relevant functions, the server does a validation on that. If the aliases were to be dependent on other inputs, the server can't do that.

This is not to say that it won't work; I've never tried it and to be honest it's not something I would ever do in a production environment anyway for the reason specified above.

In a case like this I'd write a TI process to update the alias after each update of the dimension. I doubt that the dimension would be updated often enough to really NEED real time calculation for this.

Re: Concatenating element name and attribute value in rules

Posted: Thu Aug 05, 2021 1:57 pm
by ascheevel
You can use a rule to populate an alias in an attributes cube. We've done it to populate an alias on a product dimension where the caption is the concatenation of the SKU ID and item description attributes. As Alan says, things will get messy if you inadvertently have a rule evaluating to the same alias for 2 separate elements. When that happens, you will see an error in the server log like "Alias...for element...is invalid and has been set to blank". As far as I know, that would be the only indication that you have an alias conflict; you don't get the hand-to-forehead slap you would if manually entering a duplicate alias in the attributes editor. If you do decide to use a rule, I would say heed Alan's cautions and only use a concatenation rule to define an alias if you're absolutely certain that there won't be a conflict. If you can't be 100% certain and still want to implement, you can test for duplicate aliases with a TI process. You would spin through each element in the dimension comparing the index number of each element to the index of the specified alias for the original element.