Skip to main content

Last updated: 2024-06-07


DynamicReport Method


In this topic:


Overview


The DynamicReport method retrieves the current data for a Dynamic Report by report name. The method also allows for the filter on the report to be redefined at run-time.


The DynamicReport method is invoked using the method operation.


Parameters


Parameter NameTypeRequired?Description
reportNameStringYesThis is the name of the Dynamic Report.
formatIntegerYesThis parameter indicates the data format in which report results are returned. Valid values are 1 for comma-separated values (CSV) and 2 for XML.
pageNoIntegerYesThis parameter identifies the "page" of the report being retrieved. For the initial request, the value is typically 0. If you send subsequent requests to retrieve additional pages of report results, increment this value by one in each new request.
pageSizeIntegerYesThis is the size of a report "page," i.e., the number of records to return in a single page. The maximum value allowed is 2000.
searchKeyStringNoThis parameter is required if you intend to submit multiple requests for additional pages of report results. In the initial request, this value is -1. In all subsequent requests to retrieve additional pages of data, this value must be the same as the
searchid
parameter returned in the response to the initial request.
runtimefilterStringNoThis parameter is required only if you want to modify the default report filter definition. Specify the modified filter syntax using this parameter. The default filter syntax can be retrieved using the
DynamicReportFilter method
. See the Examples section below for details.

Examples


Basic Dynamic Report Request


The following example requests the results of a Dynamic Report named "Clients with Children" using the default report filter definition.


Note the keepsession element in the request header; if you intend to send subsequent requests to retrieve more "pages" of report results, this element is required and must be set to true.


XML
<request version='1.0'>
    <header>
        <office/>
        <user/>
        <password/>
        <keepsession>true</keepsession>
    </header>
    <method>
        <DynamicReport>
            <reportName>Clients with Children</reportName>
            <format>1</format>
            <searchKey>-1</searchKey>
            <pageNo>0</pageNo>
            <pageSize>10</pageSize>
        </DynamicReport>
    </method>
</request>

The response returns the data for the report enclosed in the export element, with the report data itself enclosed in the data element:


XML
<response version="1.0">
    <header/>
    <method>
        <DynamicReport>
            <export total="10" searchid="1" pagesize="11" more="true">
                <data>Contact Name,# of Child,Record Type,,"First Name, Last Name",,Source,Subsystem Type
                "Gibbs, Tracy",2,Contact,Identity,Tracy Gibbs,0,,Contact
                "Chambers, Essie",2,Contact,Identity,Essie Chambers,0,,Contact
                "Lambert, Lillian",2,Contact,Identity,Lillian Lambert,0,,Contact
                "Lewis, Tara",2,Contact,Identity,Tara Lewis,0,,Contact
                "Walsh, Homer",2,Contact,Identity,Homer Walsh,0,,Contact
                "Gill, Wilbur",2,Contact,Identity,Wilbur Gill,0,,Contact
                "Morris, George",2,Contact,Identity,George Morris,0,,Contact
                "Hodges, Harold",2,Contact,Identity,Harold Hodges,0,,Contact
                "Fleming, Catherine",2,Contact,Identity,Catherine Fleming,0,,Contact
                "Beck, Robyn",2,Contact,Identity,Robyn Beck,0,,Contact</data>
            </export>
        </DynamicReport>
    </method>
    <_status>OK</_status>
    <_systime>2016-04-19T01:04:31</_systime>
    <!--Cost 609 mill seconds.-->
</response>

Note the following in the response:


  • The more attribute indicates whether additional pages of results are available.
  • The searchid attribute allows you to retrieve additional pages of report results (see the next example).

To retrieve the next page of results, send a new request that includes the searchid attribute from the initial response as the value of the searchKey parameter. In addition, increment the pageNo parameter by 1:


XML
<request version='1.0'>
    <header>
        <office/>
        <user/>
        <password/>
        <keepsession>true</keepsession>
    </header>
    <method>
        <DynamicReport>
            <reportName>Clients with Children</reportName>
            <format>1</format>
            <searchKey>1</searchKey>
            <pageNo>1</pageNo>
            <pageSize>10</pageSize>
        </DynamicReport>
    </method>
</request>

In the response, the value of the more attribute is false to indicate that no more results are available.


XML
<response version="1.0">
    <header/>
    <method>
        <DynamicReport>
            <export total="4" searchid="1" pagesize="10" more="false">
                <data>Contact Name,# of Child,Record Type,,"First Name, Last Name",,Source,Subsystem Type
                "Ward, Marcella",2,Contact,Identity,Marcella Ward,0,,Contact
                "Moody, Lynda",2,Contact,Identity,Lynda Moody,0,,Contact
                "Burns, Pearl",2,Contact,Identity,Pearl Burns,0,,Contact
                "Jacobs, Derrick",2,Contact,Identity,Derrick Jacobs,0,,Contact</data>
            </export>
        </DynamicReport>
    </method>
    <_status>OK</_status>
    <_systime>2016-04-19T16:48:15</_systime>
    <!--Cost 75 mill seconds.-->
</response>

If more results were available, you could then send a third request in the same manner, keeping the searchKey parameter the same (in this case, 1) and incrementing the pageNo parameter to 2.


Customizing the Report Filter Definition


You can use the DynamicReportFilter method together with the DynamicReport method to change the report's default filter definition.


First, send a request using the DynamicReportFilter method to retrieve the report's default filter:


XML
<request version='1.0'>
  <header>...</header>
  <method>
    <DynamicReportFilter>
      <reportName>A - Clients By City</reportName>
    </DynamicReportFilter>
  </method>
</request>

The response returns the filter definition syntax:


XML
<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>

Next, modify the filter syntax and include it in the runtimefilter parameter when using the DynamicReport method. In this example, the syntax has been modified to filter for "Portland" instead of the default "Los Angeles" in the City column:


XML
<request version='1.0'>
  <header>...</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>

The response returns the appropriate report data based on the modified filter:


XML
<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">Ackerman, Joseph</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>