Page 1 of 1

Getting error while loading string measure element

Posted: Fri Mar 21, 2014 11:33 am
by gandikota
Hi All,

When i am trying to archive source cube data to target cube, i am facing error for only string measure element and for other elements, the data got loaded successfully.The error info is : Data Source line (2) Error: Data procedure line (0): Cannot convert field number 6, value "No Comments" to a real number.

In my TI Code, i am creating temporary view for source cube which acts as my data source by passing parameters and filtering the view(Bedrock Cubeview create process) .The issue is arising for only string measure elements.

Can any one suggest on the above issue.

Re: Getting error while loading string measure element

Posted: Fri Mar 21, 2014 11:50 am
by EvgenyT
You are trying to load string to a numeric cell, hence the error.

Can you please provide the code


Evgeny

Re: Getting error while loading string measure element

Posted: Fri Mar 21, 2014 12:31 pm
by Michel Zijlema
EvgenyT wrote:You are trying to load string to a numeric cell, hence the error.
More specifically the issue is that you have the data variable in your variables tab set up as numeric, while the value you're receiving is string (in some cases). If the value can be either string or numeric it's better to setup the variable in TI as string and convert the value to numeric when you're loading a N-cell.

Michel

Re: Getting error while loading string measure element

Posted: Fri Mar 21, 2014 1:54 pm
by declanr
As what Michel stated I have a few stock TIs that move all the data out of a cube or into a cube and set the variable as a string then just use:

Code: Select all


sMeasureType = DType ( sDimMeasures, v5 );
If ( sMeasureType @= 'S' );
           CellPutS ( value, sCubDest, v1, v2, v3, v4, v5 );
ElseIf ( sMeasureType @= 'N' );
           nValue = StringToNumber ( Value );
           CellPutN ( nValue, sCubDest, v1, v2, v3, v4, v5 );
EndIf;

The above assumes that v5 variable equates to the measures dimension.

Re: Getting error while loading string measure element

Posted: Fri Mar 21, 2014 8:44 pm
by EvgenyT
Thanks for elaborating further guys.

Since your datasource is a view you can also take advantage of Value_is_String function.

Like Rodger said, set variable to string and use this bit below

IF(VALUE_IS_STRING=1);
CELLPUTS(sValue, vCube,vElem,vElem2....)
ELSE;
CELLPUTN(nValue,vCube,vElem,vElem2....)
ENDIF;


Evgeny

Re: Getting error while loading string measure element

Posted: Mon Mar 24, 2014 9:12 am
by gandikota
Hi All,

Thanks for the replies.

I already declared as a string in variables tab. And my measure string element is of string type in both source and target dimensions.I am getting the same error.

Here i am using cellgets and cellputs functions for fetcing and loading respectively.

Re: Getting error while loading string measure element

Posted: Mon Mar 24, 2014 9:18 am
by Michel Zijlema
gandikota wrote:Hi All,

Thanks for the replies.

I already declared as a string in variables tab. And my measure string element is of string type in both source and target dimensions.I am getting the same error.

Here i am using cellgets and cellputs functions for fetcing and loading respectively.
Could you please post a screenshot of your Variables tab?

Michel

Re: Getting error while loading string measure element

Posted: Mon Mar 24, 2014 9:21 am
by Alan Kirk
gandikota wrote:I already declared as a string in variables tab. And my measure string element is of string type in both source and target dimensions.I am getting the same error.

Here i am using cellgets and cellputs functions for fetcing and loading respectively.
You are aware, though, that it doesn't matter what data type you have the elements declared as unless they're in the last dimension in both cubes, right?

Because the only way you're getting the error that you described is if, in some way or another, you are trying to fit a round (string) peg into a square (numeric) hole.

It might be worth describing the dimensionality of the two cubes as well.

Re: Getting error while loading string measure element

Posted: Mon Mar 24, 2014 10:41 am
by EvgenyT
Given what Alan said about dimensionality and using examples myself and others provided you should not get an error. Is your last dimension a measure dimension with elements like value, string etc?
Here i am using cellgets and cellputs functions for fetcing and loading respectively.
Slightly off the topic here: using CellGets and CellPuts in this context will concatenate strings in the cell, is it what are you really after?

Thanks

Evgeny