Choose a folder in project creation macro
I am writing a project creation macro and want to create the project in a specific project folder. On our environment, users do not have rights on the project root folder and are forced to create projects in subfolders. For regular project creation, you can navigate to the folder and create the project from the folder view after which it will be created in that folder. Is that information available in the macro as well?
Alternatively, I could ask the user to choose a folder as a parameter, but how do I populate a list of project folders? There does not seem to be a parameter object for project folders (like there is for projects or plugins). The only option I see now is to add a SELECT parameter with getChoicesFromPython.
Best Answer
-
Hi,
You are correct, to achieve your goal, you need to use a a SELECT parameter with getChoicesFromPython (see this documentation). You can use the Interactive Decision Tree Builder Plugin as an example.
Inside the Python function returning choices, you can use the Dataiku API to retrieve the list of project folders. If your project folder structure has one level, you can use get_root_project_folder and list_child_folders . You can read more on the project folder methods on this page.
Hope it helps,
Alex
Answers
-
Thanks for the reply Alex! I was hoping there'd be an easier way that I had overlooked in the docs, but it seems we'll just have to write some extra code.
-
Hi Alex,
thank you for the answer and for example.
I was wandering why my plugin isn't working, so I could compare the settings from your DSS example with the mine.
Unfortunately, it seems that parameter "getChoicesFromPython" doesn't work in combination with macro role "PROJECT_CREATOR". Clement has just confirmed this assumption.
Best regards,
Viorel Pluta