Conditionally add an element to a collection

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • V4.02
    • Affects Version/s: V4.01_OS
    • Component/s: CSDL JSON, CSDL XML
    • None
    • Hide

      The if-then-else expression enables a value to be obtained by evaluating a condition expression. The if-then-else expression is called a collection-if-then-else expression if

      • it is a direct child of a collection expression or
      • it is the second or third child of a collection-if-then-else expression.

      An if-then-else expression MUST contain exactly three child expressions. There is one exception to this rule: if and only if the if-then-else expression is a direct child of a collection expression collection-if-then-else expression, the third child expression MAY be omitted, reducing it to an if-then expression. This can be used to conditionally add an element to a collection.

      Show
      The if-then-else expression enables a value to be obtained by evaluating a condition expression. The if-then-else expression is called a collection-if-then-else expression if it is a direct child of a collection expression or it is the second or third child of a collection-if-then-else expression. An if-then-else expression MUST contain exactly three child expressions. There is one exception to this rule: if and only if the if-then-else expression is a direct child of a collection expression collection-if-then-else expression , the third child expression MAY be omitted, reducing it to an if-then expression. This can be used to conditionally add an element to a collection.
    • Show
      https://github.com/oasis-tcs/odata-specs/pull/59

      OData-CSDL, section 14.4.7 allows If without third ("else") child only as a direct descendant of a Collection. But the following would also make sense:

      <Collection>
       <If>
        <Path>IsLTR</Path>
        <String>margin-left</String>
        <If>
         <Path>IsRTL</Path>
         <String>margin-right</String>
        </If>
       </If>
      </Collection>
      

      This would add "margin-left" or "margin-right" to the collection for left-to-right and right-to-left scripts, respectively, but add nothing, e.g., for top-to-bottom scripts. The If without "else" is embedded in another If.

            Assignee:
            heiko.theissen
            Reporter:
            heiko.theissen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: