Commit 25a93b35 authored by Mouadh's avatar Mouadh

changing generate celldata

parent c4b2928c
...@@ -300,17 +300,35 @@ class XmlaExecuteTools(): ...@@ -300,17 +300,35 @@ class XmlaExecuteTools():
:param mdx_execution_result: mdx_execute() result :param mdx_execution_result: mdx_execute() result
:return: CellData as string :return: CellData as string
""" """
columns_loop = []
if mdx_execution_result['columns_desc']['columns'].keys(
) and mdx_execution_result['columns_desc']['rows'].keys():
if self.executer.facts in mdx_execution_result['columns_desc'][
'columns'].keys() + mdx_execution_result['columns_desc'][
'rows'].keys():
# iterate DataFrame vertically
columns_loop = itertools.chain(* [
tuple
for tuple in mdx_execution_result['result'].itertuples(
index=False)
])
else:
# iterate DataFrame horizontally
columns_loop = itertools.chain(* [
mdx_execution_result['result'][measure]
for measure in mdx_execution_result['result'].columns
])
cell_data = "" cell_data = ""
index = 0 index = 0
for tuple in mdx_execution_result['result'].itertuples(index=False): for value in columns_loop:
for value in tuple:
cell_data += """ cell_data += """
<Cell CellOrdinal="{0}"> <Cell CellOrdinal="{0}">
<Value xsi:type="xsi:long">{1}</Value> <Value xsi:type="xsi:long">{1}</Value>
</Cell> </Cell>
""".format(index, value) """.format(index, value)
index += 1 index += 1
return cell_data return cell_data
def generate_axes_info_slicer(self, mdx_execution_result): def generate_axes_info_slicer(self, mdx_execution_result):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment