Cell Type is Real weirdness

Post Reply
MarenC
Regular Participant
Posts: 436
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Cell Type is Real weirdness

Post by MarenC »

Hi,

I have a process with the following logic on the Prolog:

Code: Select all

vAdminCube = 'Admin Cube';

vDay = cellgets(vAdminCube, 'Actuals', 'Current Year', 'Day');
sFile='C:Path\testday.txt';

If( vDay @= '03' );
    Asciioutput(sFile, 'Test Output');
Endif;
The above errors with the message Cell Type is Real. This doesn't surprise me because vDay element is actually Simple.
Also the Asciioutput doesn't execute.

Here comes the weirdness:

If in the above code I insert the following code before vDay the cell Type is real error still happens but the Aciioutput now executes!

Code: Select all

nSerialNow = NOW;
vTimeStamp= TimSt (nSerialNow, '\Y\m\d\h\i\s');
vDay=subst(vTimeStamp,7,2);

vAdminCube = 'Admin Cube';

vDay = cellgets(vAdminCube, 'Actuals', 'Current Year', 'Day');
sFile='C:Path\testday.txt';

If( vDay @= '03' );
    Asciioutput(sFile, 'Test Output');
Endif;
So it now ignores the second vDay variable declaration. I presume this is related to the fact that you can't change the data type of a varibale in TM1 but this seems like weird behaviour.

Does anyone have an explanation as to what is going on?
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Cell Type is Real weirdness

Post by tomok »

It makes perfect sense to me. In your first example trying to pull a numerical value with a CellGetS results in an error so no value is assigned to vDay and therefore the If( vDay @= '03' ); is false and nothing is written to sFile. In your second example, you are assigning a value to vDay and then trying to modify it with an invalid CellGetS statement. This doesn't work so your original assignment to vDay remains intact and the If( vDay @= '03' ); evaluates to true and the file is written.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
MarenC
Regular Participant
Posts: 436
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: Cell Type is Real weirdness

Post by MarenC »

Hi Tomok,

yes it makes perfect sense to me now! :D

Maren
Post Reply