<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: CAP - How to programmatically order by a certain colu... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13609110#M4818668</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1399380"&gt;@rui_bessa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;May be you can read from authors while applying order by age&amp;nbsp; and navigate to books with filters.&lt;BR /&gt;&lt;BR /&gt;Different examples are available here:&amp;nbsp;&lt;A href="https://community.sap.com/t5/technology-blogs-by-sap/sapcap-understanding-cql-queries-node-js/ba-p/13554662" target="_blank"&gt;https://community.sap.com/t5/technology-blogs-by-sap/sapcap-understanding-cql-queries-node-js/ba-p/13554662&lt;/A&gt;. May be this helps!!&lt;/P&gt;&lt;P&gt;Best Regards, Ajit&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 18 Feb 2024 15:06:20 GMT</pubDate>
    <dc:creator>Ajit_K_Panda</dc:creator>
    <dc:date>2024-02-18T15:06:20Z</dc:date>
    <item>
      <title>CAP - How to programmatically order by a certain column when using a path expression in NodeJS?</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaq-p/13607824</link>
      <description>&lt;P&gt;Hello experts,&lt;BR /&gt;I've been trying different ways of ordering by a certain column on a path expression while using CAP v7 with NodeJS and I have not been successful yet.&lt;/P&gt;&lt;P&gt;I've searched through the documentation but unfortunately was not able to find a similar case to mine.&lt;BR /&gt;Given the following example and supposing that the&amp;nbsp;&lt;STRONG&gt;authors&lt;/STRONG&gt; projection has a column named &lt;STRONG&gt;age&lt;/STRONG&gt;&amp;nbsp;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let books = await SELECT.from('Books').columns(books =&amp;gt; {
        books `*`,
        books.authors('*')
    }).where({ID : 1});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;How can I order all the authors from the book with ID = 1 by&amp;nbsp;&lt;STRONG&gt;age&lt;/STRONG&gt; ?&lt;BR /&gt;&lt;BR /&gt;I've tried the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let books = await SELECT.from('Books').columns(books =&amp;gt; {
        books `*`,
        books.authors('*').orderBy('age desc')
    }).where({ID : 1});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this leads to the following error :&amp;nbsp;&lt;BR /&gt;[cds] - TypeError: Cannot read properties of undefined (reading 'age')&lt;BR /&gt;&lt;BR /&gt;Is there any possible way I can order&amp;nbsp;&lt;STRONG&gt;authors&lt;/STRONG&gt; by a column in this case?&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 13:07:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaq-p/13607824</guid>
      <dc:creator>rui_bessa</dc:creator>
      <dc:date>2024-02-16T13:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: CAP - How to programmatically order by a certain colu...</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13608452#M4818612</link>
      <description>&lt;P&gt;This might be what you are looking for from syntax perspective:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;let books = await SELECT.from('Books').columns(books =&amp;gt; {
        books `*`,
        books.authors('*')`[order by age desc]`
    }).where({ID : 1});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is extended from the syntax for infix filters. But, I'm not sure if that sorts the inner array as you are expecting. My guess is sorting is not yet supported.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2024 05:25:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13608452#M4818612</guid>
      <dc:creator>Dinu</dc:creator>
      <dc:date>2024-02-17T05:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: CAP - How to programmatically order by a certain colu...</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13609110#M4818668</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1399380"&gt;@rui_bessa&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;May be you can read from authors while applying order by age&amp;nbsp; and navigate to books with filters.&lt;BR /&gt;&lt;BR /&gt;Different examples are available here:&amp;nbsp;&lt;A href="https://community.sap.com/t5/technology-blogs-by-sap/sapcap-understanding-cql-queries-node-js/ba-p/13554662" target="_blank"&gt;https://community.sap.com/t5/technology-blogs-by-sap/sapcap-understanding-cql-queries-node-js/ba-p/13554662&lt;/A&gt;. May be this helps!!&lt;/P&gt;&lt;P&gt;Best Regards, Ajit&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2024 15:06:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13609110#M4818668</guid>
      <dc:creator>Ajit_K_Panda</dc:creator>
      <dc:date>2024-02-18T15:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: CAP - How to programmatically order by a certain colu...</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13612411#M4819049</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/16653"&gt;@Ajit_K_Panda&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;BR /&gt;Thank you for the comment!&lt;BR /&gt;I think that with your suggestion, this particular problem would definitely get resolved.&amp;nbsp;&lt;BR /&gt;But I've provided a simple case to also simplify the question I wanted to ask - but in reality, my specific case is a bit more complex and I have a query which is quite more complex than the one I wrote here in my post.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've managed to workaround this by creating views on top of my entities that already come ordered by the column I want, but I really wanted to understand ( and know ) if there's a real way of ordering the way I asked &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 13:39:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-how-to-programmatically-order-by-a-certain-column-when-using-a-path/qaa-p/13612411#M4819049</guid>
      <dc:creator>rui_bessa</dc:creator>
      <dc:date>2024-02-20T13:39:16Z</dc:date>
    </item>
  </channel>
</rss>

