cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
190 stars 109 forks source link

Data Spread not working properly #254

Closed pourushgupta closed 4 years ago

pourushgupta commented 4 years ago

Hi,

I have observed very weird behavior in TM1py library. When i am trying to spread the value at consolidated level manually at no value or zero cell in tm1 then proportional spread is working fine. But the same when i am trying to achieve using TM1py then it is throwing me DataSpreadFailed exception.

Function used tm1.cubes.cells.write_values('Cubename',{("Dimension 1(Consolidation)","Dimension 2_(Consolidation)"): 'P<>1787'}) Please let me know is there any alternative to achieve this.

Regards, Pourush Gupta

rkvinoth commented 4 years ago

Hi Pourush,

Make sure you have the ProportionSpreadToZeroCells parameter in the config file as T If not, Change that to T and do a restart (read the advantages and disadvantages first). When you spread on a cell with 0 value, use P1787 rather than P<>1787 (I would use a try block for this kind of situation, feel free to provide any other thoughts).

Sample code:

from TM1py.Services import TM1Service

with TM1Service(address=ADDRESS, port=PORT, ssl=SSL, user=USER, password=PASSWORD) as tm1:

    tm1.cubes.cells.write_values('test', {("Asia", "Q1"): 'P7000'})

Output:

image

MariusWirtz commented 4 years ago

@pourushgupta For future reference, it would be great if you could confirm that the answer provided by @rkvinoth solved your problem.

pourushgupta commented 4 years ago

It worked Thanks @rkvinoth