COGNOiSe.com - The IBM Cognos Community

Planning & Consolidation => TM1 => Topic started by: donap on 15 Dec 2017 11:11:29 AM

Title: IF syntax question...
Post by: donap on 15 Dec 2017 11:11:29 AM
I want to write the following code in a TI Process -- but it keeps telling INVALID OPERATOR....


If ( vTestvalue in ('ABC', 'XYZ', 'MNL', 'rrr', ZZZ')  & vType @= vTestType2 ) ;
    DimensionElementComponentAdd (sDim, '',vTestValue,weight) ;
endif;


Is it that TM1 does not allow use of the  "IN"  clause  ???

Thanks
Title: Re: IF syntax question...
Post by: AJAYC on 16 Dec 2017 09:51:59 AM
This is correct, there is no "IN" clause.

You need to test your items within the brackets individually against vTestvalue. You can do this simplistically eg.

IF (
       ( vTestvalue @='ABC' %
         vTestvalue @='XYZ' %
         vTestvalue @='MNL' %
         vTestvalue @='rrr' %
         vTestvalue @=ZZZ' )
       &
         vType @= vTestType2 ) ;

         DimensionElementComponentAdd (sDim, vConsolidation, vTestValue, sWeight) ;

ENDIF;


The "%" represents an "OR" function. I noted you missed a parent value, so have added "vConsolidation" in your DimensionElementComponentAdd statement.

HTH
Ajay