<?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 Expand query does not function in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718314#M4831497</link>
    <description>&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/12545"&gt;@gregorw&lt;/a&gt; I double checked the await command after your reply. I already use await during the request handling, but it ends with an empty array nevertheless. const characteristicCatalogSetResult = await this.tx(request).run(characteristicCatalogQuery); I tried to add the await on the query preparation (Select statement), but in that case ended with an error.</description>
    <pubDate>Fri, 31 May 2024 15:31:14 GMT</pubDate>
    <dc:creator>cbsmerveguel</dc:creator>
    <dc:date>2024-05-31T15:31:14Z</dc:date>
    <item>
      <title>CAP Expand query does not function</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaq-p/13718218</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;We have 2 entitysets from onpremise backend that we want to do an expand to. Basically entityset1 ("InspectionLotChars") should be expanded to its navigation association ("&lt;SPAN&gt;CharacteristicCatalogSet&lt;/SPAN&gt;"). I have used below syntax to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;But it does return an empty array although&amp;nbsp;&lt;SPAN&gt;CharacteristicCatalogSet has data in it for that specific entityset InpectionLotChars.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    const characteristicCatalogQuery = SELECT.from('InspectionLotChars', a =&amp;gt; {
      a.CharacteristicCatalogSet(`*`)
        (b =&amp;gt; {
          b`.*`
        })
    }).where({
      INSPLOT: '123456789',
      INSPOPER: '0010',
      INSPCHAR: '0020'
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;During debug from JS (since same statement also called from UI5 for another app):&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getView&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;getModel&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;read&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"/InspectionLotChars(INSPLOT='"&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;found&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;INSPLOT&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;"',INSPOPER='"&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;found&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;INSPOPER&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;"',INSPCHAR='"&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;found&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;INSPCHAR&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;"')/CharacteristicCatalogSet"&lt;/SPAN&gt;&lt;SPAN&gt;);&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We realized the call from JS is interpreted into CQN as below:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;let characteristicCatalogQuery2 = SELECT.from({
      ref: [
        {
          id: 'CustomerReportService.InspectionLotChars',
          where: [
            { ref: ['INSPLOT'] }, '=', { val: '123456789' },
            'and',
            { ref: ['INSPOPER'] }, '=', { val: '0010' },
            'and',
            { ref: ['INSPCHAR'] }, '=', { val: '0020' }
          ]
        },
        'CharacteristicCatalogSet'
      ]
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And interestingly if we use this CQN directly in the CAP service, we can get the result set as well.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Would anyone have a comment why the first Select statement does not work and secondly how to convert the second one into a CQL style SELECT statement.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Appreciate for any helpful comment.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Merve&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 12:49:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaq-p/13718218</guid>
      <dc:creator>cbsmerveguel</dc:creator>
      <dc:date>2024-05-31T12:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: CAP Expand query does not function</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718298#M4831492</link>
      <description>Have you tried to add an await?</description>
      <pubDate>Fri, 31 May 2024 15:16:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718298#M4831492</guid>
      <dc:creator>gregorw</dc:creator>
      <dc:date>2024-05-31T15:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: CAP Expand query does not function</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718313#M4831496</link>
      <description>&lt;P&gt;entered this message by mistake, cant delete it. please ignore.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 15:32:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718313#M4831496</guid>
      <dc:creator>cbsmerveguel</dc:creator>
      <dc:date>2024-05-31T15:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: CAP Expand query does not function</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718314#M4831497</link>
      <description>&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/12545"&gt;@gregorw&lt;/a&gt; I double checked the await command after your reply. I already use await during the request handling, but it ends with an empty array nevertheless. const characteristicCatalogSetResult = await this.tx(request).run(characteristicCatalogQuery); I tried to add the await on the query preparation (Select statement), but in that case ended with an error.</description>
      <pubDate>Fri, 31 May 2024 15:31:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-expand-query-does-not-function/qaa-p/13718314#M4831497</guid>
      <dc:creator>cbsmerveguel</dc:creator>
      <dc:date>2024-05-31T15:31:14Z</dc:date>
    </item>
  </channel>
</rss>

