| Refresh | Home EGTry.com

list box with current year, last year and the year before last year


Step 1. create three one row queries for this year, last year and the year before last year, and union them together

year

extract(year, current_date)

extract(year, _add_years(current_date,-1))

extract(year, _add_years(current_date,-2))


three year dynamic

Step 2. create prompt control of list box, sorting items in descending order

<contents>
  <selectValue parameter="PromptYear" refQuery="ThreeYearQuery" selectValueUI="listBox" multiSelect="true" required="false">
    <useItem refDataItem="Year">
      <displayItem refDataItem="Year"/>
    </useItem>
    <sortList>
      <sortItem refDataItem="Year" sortOrder="descending"/>
    </sortList>
  </selectValue>
</contents>


sorting items for list box

step 3. display the selected year in report

<contents>
  <block>
    <contents>
      <textItem>
        <dataSource>
          <staticValue>ParamCount('PromptYear')=</staticValue>
        </dataSource>
      </textItem>
      <textItem>
        <dataSource>
          <reportExpression>ParamCount('PromptYear')</reportExpression>
        </dataSource>
      </textItem>
    </contents>
  </block>
  <block>
    <contents>
      <textItem>
        <dataSource>
          <staticValue>ParamDisplayValue('PromptYear')=</staticValue>
        </dataSource>
      </textItem>
      <textItem>
        <dataSource>
          <reportExpression>ParamDisplayValue('PromptYear')</reportExpression>
        </dataSource>
      </textItem>
    </contents>
  </block>
</contents>