How to use the mdxpy.Member function in mdxpy

To help you get started, we’ve selected a few mdxpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cubewise-code / tm1py / Tests / Cell.py View on Github external
def test_execute_mdx_raw_skip_contexts(self):
        mdx = MdxBuilder.from_cube(CUBE_NAME) \
            .add_hierarchy_set_to_row_axis(MdxHierarchySet.member(Member.of(DIMENSION_NAMES[0], "Element1"))) \
            .add_hierarchy_set_to_column_axis(MdxHierarchySet.member(Member.of(DIMENSION_NAMES[1], "Element1"))) \
            .add_member_to_where("[" + DIMENSION_NAMES[2] + "].[Element1]").to_mdx()

        raw_response = self.tm1.cubes.cells.execute_mdx_raw(
            mdx,
            skip_contexts=True,
            member_properties=["UniqueName"])

        self.assertEqual(len(raw_response["Axes"]), 2)
        for axis in raw_response["Axes"]:
            dimension_on_axis = Utils.dimension_name_from_element_unique_name(
                axis["Tuples"][0]["Members"][0]["UniqueName"])
            self.assertNotEqual(dimension_on_axis, DIMENSION_NAMES[2])
github cubewise-code / tm1py / Tests / Cell.py View on Github external
cells = {
            ('e1', 'e1'): 1,
            ('e1', 'e2'): 2,
            ('e1', 'e3'): 3,
        }
        self.tm1.cubes.cells.write_values(CUBE_RPS1_NAME, cells)

        self.tm1.cubes.cells.relative_proportional_spread(
            value=12,
            cube=CUBE_RPS1_NAME,
            unique_element_names=("[" + DIMENSION_RPS1_NAME + "].[e2]", "[" + DIMENSION_RPS2_NAME + "].[c1]"),
            reference_cube=CUBE_RPS1_NAME,
            reference_unique_element_names=("[" + DIMENSION_RPS1_NAME + "].[c1]", "[" + DIMENSION_RPS2_NAME + "].[c1]"))

        mdx = MdxBuilder.from_cube(CUBE_RPS1_NAME) \
            .add_hierarchy_set_to_column_axis(MdxHierarchySet.member(Member.of(DIMENSION_RPS1_NAME, "e2"))) \
            .add_hierarchy_set_to_row_axis(MdxHierarchySet.members([
            Member.of(DIMENSION_RPS2_NAME, "e1"),
            Member.of(DIMENSION_RPS2_NAME, "e2"),
            Member.of(DIMENSION_RPS2_NAME, "e3")])).to_mdx()

        values = self.tm1.cubes.cells.execute_mdx_values(mdx)
        self.assertEqual(next(values), 2)
        self.assertEqual(next(values), 4)
        self.assertEqual(next(values), 6)