Odd logical "AND" behaviour in TI
Posted: Fri Oct 24, 2014 1:24 am
Hi all,
TM1 version: 9.5.2
I saw this very odd behaviour in a logical operation in a TI Data tab and was wondering if you have seen a similar situation.
Naturally, like in all other programming languages I have used, I expected "IF" to evaluate the second expression if and only if the first expression to return true.
But,
Line 15 is the "IF" statement.
So I tried this,
Gives the same error as above, which is fair enough.
But
Works fine without any error.
I'm puzzled. Does TI evaluate all the expressions? That doesn't make sense. I'd like to know if you've seen this before.
Thanks...
TM1 version: 9.5.2
I saw this very odd behaviour in a logical operation in a TI Data tab and was wondering if you have seen a similar situation.
Code: Select all
if(Dimix(cDim, vGLCode) > 0 & CellIsUpdateable(cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode) = 1);
Prev_Value = CellGetN(cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode);
CellPutN (Prev_Value + Value, cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode);
endif;
But,
Code: Select all
"Plan","2015","01","X","X_Z","1002","C9998DC","024700","7.083333333333333",Data Source line (1) Error: Data procedure line (15): Invalid key: Dimension Name: "GL_Code", Element Name (Key): "024700"
"Plan","2015","01","X","X_Z","1002","CCHEFDC","024700","7.083333333333333",Data Source line (2) Error: Data procedure line (15): Invalid key: Dimension Name: "GL_Code", Element Name (Key): "024700"
So I tried this,
Code: Select all
if(CellIsUpdateable(cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode) = 1);
if(Dimix(cDim, vGLCode) > 0);
Prev_Value = CellGetN(cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode);
CellPutN (Prev_Value + Value, cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode);
endif;
endif;
But
Code: Select all
if(Dimix(cDim, vGLCode) > 0);
if(CellIsUpdateable(cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode) = 1);
Prev_Value = CellGetN(cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode);
CellPutN (Prev_Value + Value, cDestCube, vVersion, vYear, vPeriod, vCompanyCode, vProfitCentre, vGLCode);
endif;
endif;
I'm puzzled. Does TI evaluate all the expressions? That doesn't make sense. I'd like to know if you've seen this before.
Thanks...