->size()

Description of the method

Description:

->size() returns the occurrence number of the specified element.

Please note that this differs from size used with dot notation, .size(), as that method returns the length of element in OCL.

Available for:

base64binary, boolean, datetime, double/decimal, date, hexBinary, integer, string, double/decimal and integer

Parameters: -
Return type: integer

Example1

 

Context: TransactionType1
OCL:

self.Creditor.Name->size() = 1
 

Description: The example rule mandates the usage of both Creditor Name. I.e. the size of occurrence number of element Creditor / Name has to be 1.

 

The XML snippet below would pass this check.

  <Transaction>
    <Id>203</Id>
    <Amount>201</Amount>
    <Debtor>
      <Name>Debtor2</Name>
    </Debtor>
    <Creditor>
      <Name>Creditor2</Name>
    </Creditor>
  </Transaction>
  <Transaction>

The other snippet below however would not pass

<Transaction>
    <Id>203</Id>
    <Amount>201</Amount>
    <Creditor>
   
    </Creditor>
  </Transaction>
  <Transaction>