CognosTM1 Error: Syntax Error on or before Value

198 Views Asked by At

I am trying to insert a Numeric value( mesure ) to database from Tm1 cube. The variable 'Value' type in tm1 is a Numeric, and the 'Value' type in Database is decimal.

I tried to do a check if the variable contains string values , so I put them in a sperated file. And if they are Numeric I insert them in the database.

But it seems that there is an error in my sql query which states :

Syntax Error on or before Value

I dont know why it gives me an error even I checked o it and verified if it is Numeric.

Here is a snippet of my code :

 zType = DTYPE( 'Sales', Sales );

    IF(zType @= 'N');

    SQL_INSERT_N2 = 'INSERT INTO DB VALUES ( '''| dim1|''' ,  '''| dim2|''',  '''|Value|''') ' ; #error in this line

 ELSE;

 zValue =NumberToString( Value ) ;

 zText = dim1 | ';' | dim2 | ';' | Value | ; 

 ASCIIOUTPUT( zFile, zText );

ENDIF;
1

There are 1 best solutions below

0
newbie On

The problem was that I was declaring a numeric value as a string value by adding '''|Value|'''.

So it should be something like this :

SQL= 'INSERT INTO DB VALUES ( '''| dim1|''' ,  '''| dim2|''',  '|NumberToString(Value)|') ' ;