Can't assign variable

Post Reply
monishapm
Posts: 13
Joined: Mon May 17, 2010 10:10 am
OLAP Product: TM1
Version: 9.5
Excel Version: 2007

Can't assign variable

Post by monishapm »

Hi,

Prolog:

NumericSessionVariable('a');
NumericSessionVariable('b');
NumericSessionVariable('c');

StringSessionVariable('d');

Epilog:

b=ELCOMPN('dim','Consolidation');

Metadata:

While(b<1);
d=ELCOMP('dim,'Consloidation,b);
a=if(dayno(today)-Dayno
(ATTRS('dim',d,'StartDate'))>366,
1,0);
If(a=0);
DimensionElementcomponentDelete('dim','Consolidation',d);
DimensionElementcomponentAdd('dim,'Consolidation',d,+1);
EndIf;
b=b-1;
End;


actually i have to get the element in a consolidation as string variable in 'd'. but i am not getting it. Pls correct me whereever I am wrong.

Thanks,

Monisha
User avatar
Martin Ryan
Site Admin
Posts: 1989
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Can't assign variable

Post by Martin Ryan »

Hi Monisha,

First up, please start new topics by creating a new topic, rather than tacking them onto other topics at random. This makes things very confusing for both the original topic and the new topic.

Your problem is that you are inconsistently using the single quote. If you start something with a single quote, you must close it

Code: Select all

d=ELCOMP('dim,'Consloidation,b);
should be

Code: Select all

d=ELCOMP('dim','Consloidation',b);
Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
VRGultom
Posts: 8
Joined: Tue Jan 12, 2010 4:44 am
OLAP Product: SqlServer 2005
Version: SqlServer 2005
Excel Version: 2005

Re: Can't assign variable

Post by VRGultom »

http://publib.boulder.ibm.com/infocente ... 30AF9.html

The ELCOMP function returns a child of a consolidated element. This function accepts three arguments: a dimension name, an element name, and an index number for the child.

b=ELCOMPN('dim','Consolidation');

ELCOMPN returns the number of components in a specified element. If the element argument is not a consolidated element, the function returns 0.
Syntax :ELCOMPN(dimension, element)

---------------------------
While(b<1);
d=ELCOMP('dim,'Consloidation,b);
a=if(dayno(today)-Dayno
(ATTRS('dim',d,'StartDate'))>366,
1,0);
If(a=0);
DimensionElementcomponentDelete('dim','Consolidation',d);
DimensionElementcomponentAdd('dim,'Consolidation',d,+1);
EndIf;
b=b-1;
End;
---------------------------
from your code, b must be always 0 because your code : while (b<1). So the loop will be process only if b<1 which is 0

so from this code : b=ELCOMPN('dim','Consolidation');
you have to make sure that your element is not consolidated element to have b =0 to process the loop

Regards
VRG
Post Reply