It is often the case that you would like to display many similar properties on a report. Rather than enter tags for each property individually, you can loop each property (optionally filtering by type).


Note: Not all aggregate functions can be applied to every property type. For example, TRENDING_TIMESTAMP cannot be averaged.


#display datapoints with all properties

<table class='data' id='all-properties'>

  <thead>

    <tr>

      <th>ID</th>

      #loop all of the datatype's properties to display header cells

      {|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES}

        <th nowrap="nowrap" class='property-name-{PROPERTIES.PROPERTY_ID}'>{PROPERTIES.NAME}</th>

      {/|LOOP|}

    </tr>

  </thead>

  <tbody>

  {|RESULT|}

    {|LOOP|RESULT.DATAPOINTS(LIMIT=10,SORT=ID)}

    <tr class='data-row-{DATAPOINTS.DATAPOINT_ID}'>

      <th>{DATAPOINTS.DATAPOINT_ID}</th>

      #loop the properties for each datapoint and display the value

      {|LOOP|DATAPOINTS.PROPERTIES}

        <td class='property-value-{PROPERTIES.PROPERTY_ID}'>{DATAPOINTS.PROPERTIES.VALUE}</td>

      {/|LOOP|}

    </tr>

    {/|LOOP|}

  {/|RESULT|}

  </tbody>

</table>


#display datapoints with all properties of type 'percent_score'

<table class='data' id='percent-score-properties'>

  <thead>

    <tr>

      <th>ID</th>

      #loop just 'percent score' type properties for the datatype to display header cells

      {|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}

        <th nowrap="nowrap" class='property-name-{PROPERTIES.PROPERTY_ID}'>{PROPERTIES.NAME}</th>

      {/|LOOP|}

    </tr>

  </thead>

  <tbody>

    {|RESULT|}

    {|LOOP|RESULT.DATAPOINTS(LIMIT=10,SORT=ID)}

    <tr class='data-row-{DATAPOINTS.DATAPOINT_ID}'>

      <th>{DATAPOINTS.DATAPOINT_ID}</th>

      #loop the 'percent score' type properties for each datapoint and display the value

      #make sure this filter and sort matches the one for the header cells

      {|LOOP|DATAPOINTS.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}

        <td class='property-value-{PROPERTIES.PROPERTY_ID}'>{DATAPOINTS.PROPERTIES.VALUE}</td>

      {/|LOOP|}

    </tr>

    {/|LOOP|}

    {/|RESULT|}

  </tbody>

</table>


#display month_of_year aggregates for all 'score' type properties

<table id="members-avg-sectional-score">

  <thead>

    <tr>

      <th>Name</th>

      #loop just 'percent score' type properties for the datatype to display header cells

      {|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}

        <th class="name-{PROPERTIES.PROPERTY_ID}">Avg {PROPERTIES.NAME}</th>

      {/|LOOP|}

    </tr>

  </thead>

  {|RESULT|}

  <tbody>

    {|LOOP|RESULT.MONTH_OF_YEAR(SORT=NAME)}

    <tr>

      <th>{MONTH_OF_YEAR.NAME}</th>

      #loop the 'percent score' type properties for each month_of_year and display the average value

      #make sure this filter and sort matches the one for the header cells

      {|LOOP|MONTH_OF_YEAR.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}

        <td>{AVG(MONTH_OF_YEAR.PROPERTIES.VALUE).ROUND(2)}</td>

      {/|LOOP|}

    </tr>

    {/|LOOP|}

  </tbody>

  {/|RESULT|}

</table>


#loop each 'percent score' property and display a region trending table for it

{|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score)}

  <h2>{PROPERTIES.NAME}</h2>

  {|CROSSTAB|}

    {|LOOP|CROSSTAB.REGIONS(SORT=NAME)}

      {|SHOWIF|LOOP.ISFIRST}

    <table>

      <thead>

        <tr>

          <th>{DATATYPES.SHOW_DATATYPE.REGIONS.NAME}</th>

          {|LOOP|REGIONS.MONTH_YEAR(SORT=ORDER_NUM,CROSSTAB_FILTER=WITH_BLANKS_IN_RANGE)}

              <th>{MONTH_OF_YEAR.NAME}</th>

          {/|LOOP|}

        </tr>

      </thead>

      <tbody>

      {/|SHOWIF|}  

      <tr>

        <th>{REGIONS.NAME}</th>

        {|LOOP|REGIONS.MONTH_OF_YEAR}

          #in this instance we're 'looping' all of the properties with the same ID as the outer loop

          #in essence, just displaying values for that single outer property      {|LOOP|MONTH_OF_YEAR.PROPERTIES(FILTER=property_id|eq||EVALTAG(PROPERTIES.PROPERTY_ID)|)}

            <td>{AVG(MONTH_OF_YEAR.PROPERTIES.VALUE).ROUND()}</td>

          {/|LOOP|}

        {/|LOOP|}

      </tr>

    {/|LOOP|}

    </tbody>

  </table>

  {/|CROSSTAB|}

{/|LOOP|}