Requesting the Values of a Query-Based Input Control

A newer service is available to interact with input controls, including query-based input controls. See section The v2/inputControls Service.

The following sample request specifies a resource that is a query-based input control, and by specifying the appropriate parameters, we can receive the current values. In this case, one of the parameters to the query is a list of two values, USA and Mexico:

GET http://localhost:8080/jasperserver/rest/resource/reports/samples/Cascadi...
Cascading_state_multi_select?IC_GET_QUERY_DATA=/datasources/JServerJNDIDS&
PL_Country_multi_select=USA&PL_Country_multi_select=Mexico

The following response shows the resource descriptor for the requested input control, and it contains extra properties that give all the values that are the results of the query. You can see they are from Mexico and USA. The resource descriptor also includes the nested descriptor for the query that is part of the input control.

If a selection-type input control has a null value, it is given as ~NULL~. If no selection is made, its value is given as ~NOTHING~.

<resourceDescriptor name="Cascading_state_multi_select" wsType="inputControl"
                    uriString="/reports/samples/Cascading_multi_select_report_files/
                    Cascading_state_multi_select" isNew="false">
  <label>Cascading state multi select control</label>
  <description>Cascading state multi select control</description>
  <creationDate>1302268918000</creationDate>
  <resourceProperty name="PROP_RESOURCE_TYPE">
    <value>com.jaspersoft.jasperserver.api.metadata.common.domain.InputControl
    </value>
  </resourceProperty>
  <resourceProperty name="PROP_PARENT_FOLDER">
    <value>/reports/samples/Cascading_multi_select_report_files</value>
  </resourceProperty>
  <resourceProperty name="PROP_VERSION"><value>0</value></resourceProperty>
  <resourceProperty name="PROP_HAS_DATA"><value>false</value></resourceProperty>
  <resourceProperty name="PROP_IS_REFERENCE"><value>false</value></resourceProperty>
  <resourceProperty name="PROP_INPUTCONTROL_IS_MANDATORY"><value>true</value>
  </resourceProperty>
  <resourceProperty name="PROP_INPUTCONTROL_IS_READONLY"><value>false</value>
  </resourceProperty>
  <resourceProperty name="PROP_INPUTCONTROL_IS_VISIBLE"><value>true</value>
  </resourceProperty>
  <resourceProperty name="PROP_INPUTCONTROL_TYPE"><value>7</value>
  </resourceProperty>
  <resourceProperty name="PROP_QUERY_VALUE_COLUMN">
    <value>billing_address_state</value></resourceProperty>
  <resourceProperty name="PROP_QUERY_VISIBLE_COLUMNS">
    <resourceProperty name="PROP_QUERY_VISIBLE_COLUMN_NAME">
      <value>billing_address_country</value></resourceProperty>
    <resourceProperty name="PROP_QUERY_VISIBLE_COLUMN_NAME">
      <value>billing_address_state</value></resourceProperty>
  </resourceProperty>
  <resourceProperty name="PROP_QUERY_DATA">
    <resourceProperty name="PROP_QUERY_DATA_ROW"><value>DF</value>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>Mexico</value></resourceProperty>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>DF</value></resourceProperty>
    </resourceProperty>
    ...
    <resourceProperty name="PROP_QUERY_DATA_ROW"><value>Zacatecas</value>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>Mexico</value></resourceProperty>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>Zacatecas</value></resourceProperty>
    </resourceProperty>
    <resourceProperty name="PROP_QUERY_DATA_ROW"><value>CA</value>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>USA</value></resourceProperty>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>CA</value></resourceProperty>
    </resourceProperty>
    ...
    <resourceProperty name="PROP_QUERY_DATA_ROW"><value>WA</value>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>USA</value></resourceProperty>
      <resourceProperty name="PROP_QUERY_DATA_ROW_COLUMN">
        <value>WA</value></resourceProperty>
    </resourceProperty>
  </resourceProperty>
  <resourceDescriptor name="Cascading_state_query" wsType="query" uriString="/
                      reports/samples/Cascading_multi_select_report_files/
                      Cascading_state_multi_select_files/Cascading_state_query"
                      isNew="false">
    <label>Cascading state query</label>
    <creationDate>1302268918000</creationDate>
    <resourceProperty name="PROP_RESOURCE_TYPE">
      <value>com.jaspersoft.jasperserver.api.metadata.common.domain.Query</value>
    </resourceProperty>
    <resourceProperty name="PROP_PARENT_FOLDER">
      <value>/reports/samples/Cascading_multi_select_report_files/
             Cascading_state_multi_select_files</value></resourceProperty>
    <resourceProperty name="PROP_VERSION"><value>0</value></resourceProperty>
    <resourceProperty name="PROP_HAS_DATA"><value>false</value></resourceProperty>
    <resourceProperty name="PROP_IS_REFERENCE"><value>false</value>
    </resourceProperty>
    <resourceProperty name="PROP_QUERY">
      <value>select distinct billing_address_state, billing_address_country
             from accounts where $X{IN, billing_address_country,
             Country_multi_select} order by billing_address_country,
             billing_address_state</value>
    </resourceProperty>
    <resourceProperty name="PROP_QUERY_LANGUAGE"><value>sql</value>
    </resourceProperty>
    <resourceDescriptor name="" wsType="datasource" uriString="" isNew="false">
      <label>null</label>
      <resourceProperty name="PROP_REFERENCE_URI">
        <value>/datasources/JServerJNDIDS</value></resourceProperty>
      <resourceProperty name="PROP_IS_REFERENCE"><value>true</value>
      </resourceProperty>
    </resourceDescriptor>
  </resourceDescriptor>
</resourceDescriptor>
Version: 
Feedback
randomness