Page last modified 17:21, 11 Jan 2016 by Antero

->size()

    Table of contents

    Version as of 04:33, 14 Oct 2019

    to this version.

    Return to Version archive.

    View current version

    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. Note the second occurrence of transaction, expression is true because amount is not above 200.

      <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>

    Menu