cubewise-code / bedrock

Bedrock is TM1 Best Practice assets built from years of TM1 experience
Other
79 stars 74 forks source link

Clearing attributes #320

Closed wimgielis closed 2 years ago

wimgielis commented 2 years ago

What does the community think ?

With the process '}bedrock.cube.data.clear we clear data. To clear attributes data, we can pass the parameters (for a Customer dimension):

Would it make sense to have a clean 'wrapper process' like '}bedrock.cube.data.clear.attributes where we specify:

Then the process will just call the regular cube.data.clear process with reworked parameters. The validations can all stay in the called process. The only quick validations that could be done is that the dimension name should exist, that the dimension should have attributes, but that's about it.

I think it will make it easier to read, less errors, etc.

Maybe a similar logic could be used to clear }ElementSecurity cubes by just specifying dimension names, element selections, group selections. Calling the cube.data.clear process with the correct parameters for cube and filter.

lotsaram commented 2 years ago

If you want to write a new wrapper @wimgielis then I would have no issue to add it to the library.
However, I would question whether it actually adds any value, since as you mention the new process would be doing nothing more than calling the existing cube.data.clear and swapping cube name for dimension name and appending the attribute dimension to the filter.
Looking at current naming conventions I think the appropriate name for such a wrapper would be }bedrock.dim.attr.clear
Another way to achieve the same result would be to call the existing }bedrock.dim.attr.delete and }bedrock.dim.attr.create processes (for some cases I can imagine it might be quicker to delete and recreate attributes versus clearing data, although clearing is always preferable to deleting and recreating elements in terms of avoiding locking).