.parent()

Description of the method
Description:

.parent() navigates to the parent of the element. It can be used to  reach over the context of the rule.

Available for:

any element

Parameters: parent element type 
Return type: element

Example 1

Context: CreditTransferTransactionInformation
OCL: self.parent(PaymentInstructionInformation).PmtTpInf.SvcLvl.Cd.matches("SEPA")
Description: The example rule checks if the parent element has Service level code populated with value SEPA.

 

The XML snippet below would pass this check.

<PmtInf>
      <PmtInfId>1234</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <PmtTpInf>
        <SvcLvl>
          <Cd>SEPA</Cd>
        </SvcLvl>
      </PmtTpInf>
      <ReqdExctnDt>2023-01-01</ReqdExctnDt>
      ...
      <CdtTrfTxInf>
        <PmtId>
          <EndToEndId>12345</EndToEndId>
        </PmtId>
        <Amt>
          <InstdAmt Ccy="EUR">100</InstdAmt>
        </Amt>
        ...
      </CdtTrfTxInf>
    </PmtInf>

The other snippet below however would not pass this check as the value is different from "SEPA".

<PmtInf>
      <PmtInfId>1234</PmtInfId>
      <PmtMtd>TRF</PmtMtd>
      <PmtTpInf>
        <SvcLvl>
          <Cd>NURG</Cd>
        </SvcLvl>
      </PmtTpInf>
      <ReqdExctnDt>2023-01-01</ReqdExctnDt>
      ...
      <CdtTrfTxInf>
        <PmtId>
          <EndToEndId>12345</EndToEndId>
        </PmtId>
        <Amt>
          <InstdAmt Ccy="EUR">100</InstdAmt>
        </Amt>
        ...
      </CdtTrfTxInf>
    </PmtInf>