Adding multiple variables to a stored query expand/collapse all
Related Topics

Creating stored queries

STOREDQUERIES

expand/collapse item About stored queries

In Author you can create stored queries with one variable. For more information on stored queries, see Creating stored queries. If you are using image services with the HTML Viewer or viewers using the Web Application Developer Framework (ADF), you can add additional variables. Stored queries with multiple variables will not work correctly in ArcExplorer - Java Edition or the Java Viewers.

expand/collapse item How to add additional variables to a stored query

expand/collapse item Adding additional variables to a stored query

  1. Open your map configuration file in a text or XML editor.
  2. Find the stored query you created in Author to which you want to add additional variables.

    <EXTENSION type="StoredQuery">
      <STOREDQUERIES >
        <STOREDQUERY name="Multiple_variables" >
          <QUERY where="POPULATION > [%var%]" subfields="#SHAPE# NAME CAPITAL PROV_NAME POPULATION" />
          <SQVAR position="0" name="[%var%]" >
            <FIELD name="POPULATION" precision="0" type="-5" size="11" />
          <SQVAR />
        <STOREDQUERY />
      <STOREDQUERIES />
    </EXTENSION>

  3. Add one or more additional variables. The syntax for the first variable defined by Author is "%var%". Each additional variable must be unique. In the following example, "%var1%" is added to the query.

    <EXTENSION type="StoredQuery">
      <STOREDQUERIES >
        <STOREDQUERY name="Multiple_variables" >
          <QUERY where="(POPULATION > [%var%]) AND (POPULATION < [%var1%])" subfields="#SHAPE# NAME CAPITAL PROV_NAME POPULATION" />
          <SQVAR position="0" name="[%var%]" >
            <FIELD name="POPULATION" precision="0" type="-5" size="11" />
          <SQVAR />
        <STOREDQUERY />
      <STOREDQUERIES />
    </EXTENSION>

  4. For each variable you added in the previous step, you must also include SQVAR.
    • The SQVAR position attribute must be sequential. Author assigned SQVAR position="0" to the first variable. You need to assign SQVAR position="1" to the first variable you add, and so forth.
    • The FIELD is the field you want to query. The FIELD name and type are required attributes. For more details on these attributes, see FIELD.

    <EXTENSION type="StoredQuery">
      <STOREDQUERIES >
        <STOREDQUERY name="Multiple_variables" >
          <QUERY where="(POPULATION > [%var%]) AND (POPULATION < [%var1%])" subfields="#SHAPE# NAME CAPITAL PROV_NAME POPULATION" />
          <SQVAR position="0" name="[%var%]" >
            <FIELD name="POPULATION" precision="0" type="-5" size="11" />
          <SQVAR />
          <SQVAR position="1" name="[%var1%]" >
            <FIELD name="POPULATION" precision="0" type="-5" size="11" />
          <SQVAR />
        <STOREDQUERY />
      <STOREDQUERIES />
    </EXTENSION>

  5. Save your changes to the map configuration file.

Once you have added new variables to a stored query, you should not open or save your map configuration file in author. Your edits will be removed.



Search code: @config_stored_query