Page 1 of 1

Alias Strangess

Posted: Fri Apr 20, 2012 2:45 pm
by jim wood
Guys,

I am running the following code to set an alias based on possible repartition found within the original hierarchy stored stored as text attribute. (The repartition within dimension source is taken care of in the dimbuild process.)

Code: Select all

[b]Prolog[/b]

vAliasName='Product_Alias_Attribute';

ATTRDELETE('mpl_Product_WCP',vAliasName);

savedataall();

ATTRINSERT('mpl_Product_WCP','',vAliasName,'A');

[b]MetaData[/b]

#****Begin: Generated Statements***
Text_Attribute=ATTRS('mpl_Product_WCP',mpl_Product_WCP,'Product_Text_Attribute');
#****End: Generated Statements****

vAliasBase=Text_Attribute;
vAliasOne=vAliasBase|'-';
vAliasTwo=vAliasBase|'--';
vAliasThree=vAliasBase|'---';
vAliasFour=vAliasBase|'-----';
vElement=mpl_Product_WCP;

IF(DIMIX('mpl_Product_WCP',vAliasBase)=0);
  AttrPutS(vAliasBase,'mpl_Product_WCP',vElement, vAliasName);
  ElseIF(DIMIX('mpl_Product_WCP',vAliasOne)=0);
  AttrPutS(vAliasOne,'mpl_Product_WCP',vElement, vAliasName);
  ElseIF(DIMIX('mpl_Product_WCP',vAliasTwo)=0);
  AttrPutS(vAliasTwo,'mpl_Product_WCP',vElement, vAliasName);
  ElseIF(DIMIX('mpl_Product_WCP',vAliasThree)=0);
  AttrPutS(vAliasThree,'mpl_Product_WCP',vElement, vAliasName);
  ElseIF(DIMIX('mpl_Product_WCP',vAliasFour)=0);
  AttrPutS(vAliasFour,'mpl_Product_WCP',vElement, vAliasName);
EndIF;
It seems that despite the alias being deleted it is retaining it's content within memory so when I check the index it thinks there is an alias in place even though the alias had been deleted. Has anybody else hit this issue?

Jim.

PS. I tried adding a save data all to force a commit.

Re: Alias Strangess

Posted: Fri Apr 20, 2012 2:55 pm
by tomok
I can't speak to your situation because I've never seen anyone try something quite like you are doing here but every time I've had an unexplained alias issue the only solution has been to re-cycle the server to get a clean look.

Re: Alias Strangess

Posted: Fri Apr 20, 2012 2:59 pm
by jim wood
That does work but it's not practical for what we are doing.

Re: Alias Strangess

Posted: Fri Apr 20, 2012 3:02 pm
by declanr
I seem to recall hitting something like this a couple of years ago (due to the timeframe my memory may be lacking in areas)... I never really got to the bottom of why it was happening but seemed to be able to solve it by running the TI in 2 parts e.g.

TI A contains the delete attribute command and a savedataall. Then finishes by executing TI B

TI B obviously contains the add alias etc.


Like I say I never got to the bottom of explaining why this was a problem or why the solution seemed to work (and I think this would have been while I was using 9.5.1 or possibly 9.5.2), it was part of a list of a million or so problems and as such if something worked I didn't exactly have the time to work out why it worked... looking a gift horse in the mouth etc.

Would be interesting to know if this solution works for you? And if it does would anyone care to explain the logic?

Re: Alias Strangess

Posted: Fri Apr 20, 2012 3:12 pm
by jim wood
It didn't work for me. I created a temp process that contains the delete and save data only. I ran this then I re-ran my normal process with out success,

Jim.

Re: Alias Strangess

Posted: Fri Apr 20, 2012 3:24 pm
by declanr
jim wood wrote:It didn't work for me. I created a temp process that contains the delete and save data only. I ran this then I re-ran my normal process with out success,
Like I say it was a while ago so I may have got myself confused on how it was actually solved.

If the only issue is that you want to essentially "clear out" the existing aliases... could you just add an extra step where rather than deleting the entire attribute you just commit the principle name back to being the alias so it would essentially be at the same state it is when the attribute/alias is newly created?

Re: Alias Strangess

Posted: Fri Apr 20, 2012 5:43 pm
by jim wood
Good call Declan. I was going to try some other approaches like writing back blank values to the control cube but that's an excellent idea thanks,

Jim.

Re: Alias Strangess

Posted: Fri Apr 20, 2012 6:23 pm
by jim wood
Declan,

That worked really well. (Instead of creating a new process I just had to use both the meta data and data tabs.) Thank you very much sir. You are both a scholar and a gent,

Jim.

Re: Alias Strangess

Posted: Mon Dec 10, 2012 12:16 pm
by qml
I just stumbled across this old thread and thought I'd share my alternative solution.

If I need to purge alias values from memory without bouncing the server so that they can be reused, I find the following approach to work.

1) Create a separate subprocess that has any data source with 1 row only.

2) On the Prolog tab delete the alias (AttrDelete) and add a dummy element to your dimension (DimensionElementInsert).

3) On the Metadata tab remove the dummy element you added in Prolog (DimensionElementDelete).

4) On the Epilog tab recreate the alias you deleted in Prolog (AttrInsert).

After executing such a subprocess the dimension should be recompiled and have no memory of the alias values assigned before, so they can be reused.

I have never encountered problems with this logic, but it might be version dependent etc, so use with caution and test thouroughly before deploying in prod.

Re: Alias Strangess

Posted: Mon Dec 10, 2012 2:37 pm
by jim wood
A nice little work around. I've seen other people on here sharing such pains so this will be really useful, Thanks.