current

Refers to an item in a list being processed.

The current expression may only appear within an expression which processes items in a list, such as:

For clarity, you can assign an alias to the current expression, which must match the alias on the list expression referred to. Alias are required if there are more than current expressions in scope in the same calculation.

<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_listitem"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
  <Class name="Household">

    <Attribute name="members">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="adults">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <filter>
          <list>
            <reference attribute="members"/>
          </list>
          <listitemexpression>
            <!-- The reference uses current to refer
                   to an item in the list of Person
                   rule objects. -->
            <reference attribute="isAdult">
              <current/>
            </reference>
          </listitemexpression>
        </filter>
      </derivation>
    </Attribute>

  </Class>

  <Class name="Person">

    <Attribute name="children">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="age">
      <type>
        <javaclass name="Number"/>
      </type>
      <derivation>
        <specified/>
      </derivation>
    </Attribute>

    <Attribute name="isAdult">
      <type>
        <javaclass name="Boolean"/>
      </type>
      <derivation>
        <compare comparison=">=">
          <reference attribute="age"/>
          <Number value="18"/>
        </compare>

      </derivation>
    </Attribute>

    <!-- The children of this person who
         are not yet adults. -->
    <Attribute name="dependentChildren">
      <type>
        <javaclass name="List">
          <ruleclass name="Person"/>
        </javaclass>
      </type>
      <derivation>
        <filter>
          <!-- Use an alias to avoid confusion (for human
               readers of the rule set!) between the parent
               Person and the child Person.  -->
          <list alias="child">
            <reference attribute="children"/>
          </list>
          <listitemexpression>
            <not>
              <reference attribute="isAdult">
                <!-- The alias on the current must match
                   that on the list. -->
                <current alias="child"/>
              </reference>
            </not>
          </listitemexpression>
        </filter>
      </derivation>
    </Attribute>

  </Class>

</RuleSet>