Page 1 of 1

Loading a csv with numeric and string value

Posted: Thu Feb 23, 2017 8:59 am
by TM1user_pri
Hi TM1 masters,
Need your advice in below issue.

Issue is quite a general one and I have read other posts in this forum, but I am still thinking it will not cause a problem afterwards.
I am loading a csv into a cube. Cube has 4dimensions:dim1,dim2,dim3,Measure.
Measure dimension contains around 150 elements :of which all elements store numeric values ,only 2 elements store string values.

In variables tab, If I consider measure as "Numeric", so while loading csv it will generate below error-"Cannot convert field number '', value " " to a real number.

I can understand that cellputN,cellputS giving error for this case.

If I use below code, then I need to take measure as "String" using NUMBR function, it does not generate any error
ctype= dtype('Measure',Value);

If( ctype @= 'N');
cellputN(numbr(Value),cCube,dim1,dim2,dim3,Measure);
else;
CellPutS(Value,cCube,dim1,dim2,dim3,Measure);
endif;

is this the right approach or there is any other workaround?
I will use this cube as a staging cube and using Rules, I will load the values into other cubes.

Please guide. thanks.

Re: Loading a csv with numeric and string value

Posted: Thu Feb 23, 2017 9:51 am
by Wim Gielis
Yes this is fine.

Other conversion functions that you can consider:
http://www.wimgielis.com/tm1_numbersandstrings_EN.htm

Re: Loading a csv with numeric and string value

Posted: Thu Feb 23, 2017 10:39 am
by TM1user_pri
Thanks Wim. Cheers!

Re: Loading a csv with numeric and string value

Posted: Thu Feb 23, 2017 11:00 am
by BariAbdul