You are here: Foswiki>Main Web>XmlEngine>DynamicReport (revision 3)EditAttach

DynamicReport Method

The DynamicReport Method allows you to retrieve the current data for a SmartOffice Dynamic Report by Report Name. The method also allows for the filter on the report to be redefined at run-time.

First, run the DynamicReportFilter method to retrieve the default filter definition in the exact syntax you will use later:

XML Request
<request version='1.0'>
  <header>
    <office>BryanQAQA3</office>
    <user>admin</user>
    <password>******</password>
  </header>
  <method>
    <DynamicReportFilter>
      <reportName>A - Clients By City</reportName>
    </DynamicReportFilter>
  </method>
</request>

XML Response
<response version="1.0">
  <header>
    <sessionClosed/>
  </header>
  <method>
    <DynamicReportFilter>
<![CDATA[
  <filter fltrkey="1">
    <filter fltrkey="2">
      <systemFilter fltrkey="3" fltrnm="Postal Address" id="address-contact" sqlop="eq">
        <filter fltrkey="2">
          <element colName="City" colid="393223" fltrkey="3" sqlop="eq" value="Los Angeles"/>
        </filter>
      </systemFilter>
    </filter>
    <filter fltrkey="3">
      <element colName="Type" colid="65627" fltrkey="5" sqlop="eq" value="Client"/>
      <element colName="Sub-Type" colid="65541" fltrkey="6" sqlop="eq" value="A"/>
    </filter>
  </filter>
]]>
    </DynamicReportFilter>
  </method>
  <_status>OK</_status>
  <!--Cost 49 mill seconds.-->
</response>

Now that you know the syntax for the filter, you can use a modified version of it in a new runtimefilter property in the DynamicReport method. In the example below, I change the City to filter on Portland instead of Los Angeles.

XML Request
<request version='1.0'>
  <header>
    <office>BryanQAQA3</office>
    <user>admin</user>
    <password>******</password>
  </header>
  <method>
    <DynamicReport>
      <reportName>A - Clients By City</reportName>
      <format>2</format>
      <searchKey>-1</searchKey>
      <pageNo>-1</pageNo>
      <pageSize>0</pageSize>
      <runtimefilter>
<![CDATA[
  <filter fltrkey="1">
    <filter fltrkey="2">
      <systemFilter fltrkey="3" fltrnm="Postal Address" id="address-contact" sqlop="eq">
        <filter fltrkey="2">
          <element colName="City" colid="393223" fltrkey="3" sqlop="eq" value="Portland"/>
        </filter>
      </systemFilter>
    </filter>
    <filter fltrkey="3">
      <element colName="Type" colid="65627" fltrkey="5" sqlop="eq" value="Client"/>
      <element colName="Sub-Type" colid="65541" fltrkey="6" sqlop="eq" value="A"/>
    </filter>
  </filter>
]]>
      </runtimefilter>
    </DynamicReport>
  </method>
</request>

XML Response
<response version="1.0">
  <header>
    <sessionClosed/>
  </header>
  <method>
    <DynamicReport>
      <export total="1" searchid="-1" pagesize="2001" more="false">
        <data>
          <DynamicReport>
            <heading>
              <col id="0">Contact Name</col>
              <col id="1">Type</col>
              <col id="2">Source</col>
              <col id="3">Occupation</col>
              <col id="4">Birth Date</col>
              <col id="5">Review Date</col>
              <col id="6">Total Premium</col>
            </heading>
            <rows>
              <row>
                <col id="0">Tillamook, Cheesey</col>
                <col id="1">Client</col>
                <col id="6">0</col>
              </row>
            </rows>
          </DynamicReport>
        </data>
      </export>
    </DynamicReport>
  </method>
  <_status>OK</_status>
  <!--Cost 151 mill seconds.-->
</response>

If you need to adjust the format of the returned data, modify the <format> values to 1, 2 or 3 depending on the desired output:

1 = .csv
2 = .xml
3 = .pdf



-- DustinFox - 28 Nov 2012
Edit | Attach | Print version | History: r6 | r4 < r3 < r2 < r1 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: 28 Nov 2012, dustin
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback