Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-1435

Conditionally add an element to a collection

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.01_OS
    • Fix Version/s: V4.02
    • Component/s: CSDL JSON, CSDL XML
    • Labels:
      None
    • Proposal:
      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.
    • Resolution:
      Show
      https://github.com/oasis-tcs/odata-specs/pull/59

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              heiko.theissen Heiko Theissen
              Reporter:
              heiko.theissen Heiko Theissen
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: