ten.ops_from_xml_str(qry_str)

Create ops from a string representing 1010data's xml-based Macro Language.

Syntax

ten.ops_from_xml_str(qry_str)

Arguments

qry_str
A string representing a Macro Language query.

Returns

An ops formed from the Macro Language query.

Example

<code language_="python">
  <![CDATA[

def base(table):
  return ten.ops_from_xml_str(f'<base table={table}/>')

def willbe(name, value):
  return ten.ops_from_xml_str(f'<willbe name="{name}" value="{value}"/>')

def sel(value):
  return ten.ops_from_xml_str(f'<sel value="{value}"/>')

def tcols(src, fun, name):
  return ''.join([f'<tcol source="{s}" fun="{f}" name="{n}"/>'
     for s,f,n in zip(src, fun, name)])

def tabu(breaks, tcols):
  return ten.ops_from_xml_str(f'<tabu breaks="{breaks}">{tcols}</tabu>')

ops = base('sales_detail')+\
sel('date >= 20200101')+\
willbe('profit','xsales - cost')
tc = tcols(['profit','store'],['sum','cnt'],['total_profit', 'num_stores'])
ops += tabu('date',tcols = tc)
  ]]>
</code>