-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to pass element selection as iterator in get_value function #814
Conversation
Elements can now be passed not only as string but also as an Iterator. This prevents previous problems with choosing a separator for the element string completely.
Use functionalities of the mdxpy.Member Object to simplify construction of the MDX query.
Hi @tobiaskapser, thanks! I like it. It's kinda disturbing that the argument is called I will merge it as is. |
Or maybe we could change it. Like we could introduce a new argument as position 2 and call it Then we could extract Not sure if it's worth it though only to have descriptive argument names... |
I could not think of a way to resolve this |
That is a good idea! |
Tested it. There is one problem with this approach: Suppose the user passed element_string as a keyword argument, not as a positional argument. Like this: get_value(cube_name, element_string="Element1,Element2,Element3") This function call would be okay in the current version. If we now change the second argument to |
Would it work if we set the default value for elements to None then? |
That seems to work! I added the commits to my fork. |
Provides more user friendly function interface. The parameter "element_string" can still be accessed through kwargs to provide backward compatibility.
Hi together,
@MariusWirtz
We discussed the option to pass element coordinates as Iterators to the
get_value()
-function. That would remove the need to specify special separators for the element string.You also had the idea to use the MDXpy
Member
object. I tried that and it worked out really nice! :)It also simplifies the building of the MDX statement, because it provides the
unique_name
directly.This could be used to create the
Member
directly from the splitted strings too. After that the MDX query can be build independently of the input type always from theMember
object.So I did some little restructuring to use the
Member
consistently throughout the function.The
get_value
function is now callable without hierarchies like this:or with hierarchies like this:
or directly with the
mdxpy.Member
objectsUnfortunately this has the disadvantage that the user has to always provide the dimension name. If not given it is not distinguishable if the next element belongs to the next dimension or to the same dimension but another hierarchy.
Does anyone see an option to determine that?