Automate addition of new parameter #617
mmastrolonardo
started this conversation in
General
Replies: 1 comment
-
This should do the trick 🐍 from TM1py import TM1Service
NEW_PARAMETERS = [
{'Name': 'pNew1', 'Prompt': 'pNew1 ?', 'Value': 1, 'Type': 'Numeric'},
{'Name': 'pNew2', 'Prompt': 'pNew2?', 'Value': 'text', 'Type': 'String'}]
with TM1Service(address="", port=12354, ssl=True, user="admin", password="apple") as tm1:
process_names = tm1.processes.get_all_names()
for process_name in process_names:
process = tm1.processes.get(process_name)
for new_parameter in NEW_PARAMETERS:
process.add_parameter(
name=new_parameter["Name"],
prompt=new_parameter["Prompt"],
value=new_parameter["Value"],
parameter_type=new_parameter["Type"])
tm1.processes.update(process) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to add a few new parameters (always the same ones) to different processes.
Do do this, I started writing a Script to process the text (.pro) files directly but then I realized that this is possible via tm1py with also live commit of the new process code (no need to copy the new files and restart the server).
All what one would need to do is to retrieve the process definition from the server, add the new parameters to the parameter array and then commit the process again (with the same prolog, metadata, data, epilog blocks)...
I am wondering whether anybody has already developed a small python script that make part of the process above..
Thanks.
Marco
Beta Was this translation helpful? Give feedback.
All reactions