Missing Semi Colon in Rule ?

Post Reply
User avatar
LeeTaylor1979
Posts: 63
Joined: Mon Aug 25, 2008 12:53 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2010

Missing Semi Colon in Rule ?

Post by LeeTaylor1979 »

Hi all,

I am trying to write what i thought is a simply rule but keep getting the message missing semi Colon when I am clearly not.

My rule is:

IF(Mattype @= 'N');
'Quantity' = 'Occurrences';
Else;
'Quantity' = 'Number of Landings';
Endif;

Some added information, Mattype is a variable which holds either N or Y.
The quantity I am trying to change is the element in the measures dimension and not the actual quantity on the source file (Variable)

I then use the following:

CellPutN( Quantity + CellGetN( 'SalesHistory', Country, Aircraft, Customer, Material, Version, Currency, BusinessUnit, 'Quantity', Division,Period ),
'SalesHistory', Country, Aircraft, Customer, Material, Version, Currency, BusinessUnit, 'Quantity', Division, Period );

I have tried everything I can think of but still comes back with missing semi colon.

Can anyone see where I am going wrong.

Many thanks

Lee
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: Missing Semi Colon in Rule ?

Post by Michel Zijlema »

What at least is wrong is that you have single quotes around quantity, making this a string literal instead of a variable - and you can't assign a value to a string literal.

Michel
User avatar
qml
MVP
Posts: 1094
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Missing Semi Colon in Rule ?

Post by qml »

In your code you're trying to assign a string value to another string value (NOT variable). How could that possibly work?

Try:

Code: Select all

IF(Mattype @= 'N');
Quantity = 'Occurrences';
Else;
Quantity = 'Number of Landings';
Endif;
and then

Code: Select all

CellPutN( Quantity + CellGetN( 'SalesHistory', Country, Aircraft, Customer, Material, Version, Currency, BusinessUnit, Quantity, Division,Period ), 
'SalesHistory', Country, Aircraft, Customer, Material, Version, Currency, BusinessUnit, Quantity, Division, Period );
Edit: too late.
Kamil Arendt
User avatar
LeeTaylor1979
Posts: 63
Joined: Mon Aug 25, 2008 12:53 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2010

Re: Missing Semi Colon in Rule ?

Post by LeeTaylor1979 »

Maybe I need to explain a little clearer what I am trying to achieve.

In my source file I have a column that is called mattype and also a column that is called Quantity.

Mattype hold either a N or a Y

In my cube I have a dimension called Measures which has Quantity, Occurrences and Number of landing as elements.

I am trying to do the following:

If Mattype is N then change the element Quantity in the cellput to be Occurrences or if Y then Number of Landings.

Can this be done ? If so how ?

Many thanks
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Missing Semi Colon in Rule ?

Post by Alan Kirk »

LeeTaylor1979 wrote:Maybe I need to explain a little clearer what I am trying to achieve.
Considering that the thread heading is "Missing semi colon in Rule" and you're now describing a "source file" suggesting that it's actually a TI process... you could be right. ;)
LeeTaylor1979 wrote:In my source file I have a column that is called mattype and also a column that is called Quantity.

Mattype hold either a N or a Y

In my cube I have a dimension called Measures which has Quantity, Occurrences and Number of landing as elements.

I am trying to do the following:

If Mattype is N then change the element Quantity in the cellput to be Occurrences or if Y then Number of Landings.

Can this be done ? If so how ?
What you really want is for the element name to change based on what the MatType is. Quantity is, as I understand it, simply the value field in your data source, even though it may also be an element name in your measures dimension. (An element which, according to what you've written, you aren't using in at least this part of the upload.) Make what you're currently calling "quantity" a variable representing the element name like so:

Code: Select all

IF(Mattype @= 'N');
    s_Quantity = 'Occurrences';
Else;
    s_Quantity = 'Number of Landings';
Endif;

CellPutN( Quantity + CellGetN( 'SalesHistory', Country, Aircraft, Customer, Material, Version, Currency, BusinessUnit, s_Quantity, Division,Period ),
'SalesHistory', Country, Aircraft, Customer, Material, Version, Currency, BusinessUnit, s_Quantity, Division, Period );
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
LeeTaylor1979
Posts: 63
Joined: Mon Aug 25, 2008 12:53 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2010

Re: Missing Semi Colon in Rule ?

Post by LeeTaylor1979 »

Alan, Thank you so much that has done the trick.

And you are quite right I have been talking about a TI process this whole time but failed to notice I used the word rule in my title :oops:

I blame the heat I am not used to it coming from the midlands.

thanks to all for your help.
Post Reply