Closed echangcl closed 4 years ago
Hi @echangcl,
currently, the attribute_type
argument is case sensitive. It expects to be String
, Numeric
or Alias
.
I will adjust the function to behave case and space insensitive, as you would expect for a TM1 library. Thanks for the catch!
Hi, Marius Thx. In "ElementAttribute" objects, I found valid type as "STRING, NUMERIC, ALIAS", so I thought it should all be capital... It did work with String, Numeric or Alias now.
Eddie
Describe what did you try to do with TM1py Describe the script you ran and what it is supposed to do. Hi, I try to create a new attribute with TM1py, but it didn't work my script and result as below:
==================== Script
import configparser from TM1py import TM1Service from TM1py.Objects import Cube, Dimension, Element, Hierarchy, Process, ElementAttribute
config = configparser.ConfigParser() config.read('c:/Users/User/Desktop/TM1py/config.ini')
tm1_source = TM1Service(config['COVID-19']) tm1_target = TM1Service(config['Sync'])
dim = 'Country' source = tm1_source.dimensions.get(dim)
attr = ElementAttribute(name = 'test', attribute_type = 'STRING') print(dim, attr) tm1_target.dimensions.hierarchies.elements.create_element_attribute(dim, dim, attr)
==================== the print of dim & attr as below:
Country {"Name": "test", "Type": "STRING"}
Version
Additional context If you encounter an error, please add the error message and the stack trace
==================== Error message (it happened when "create_element_attribute)
TM1pyException: Text: {"error":{"code":"278","message":"Invalid enum value encountered in payload."}} Status Code: 400 Reason: Bad Request Headers: {'Content-Length': '95', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'OData-Version': '4.0'}