MarkMpn / Sql4Cds

SQL 4 CDS core engine and XrmToolbox tool
MIT License
74 stars 22 forks source link

SQL 4 CDS is not showing all results #481

Closed SpaceManMat closed 3 months ago

SpaceManMat commented 3 months ago

I have a query that returns more than 100 records as long as I don't select the primary key from one table. When I select the primary key it only displays 2 records and it shows and red exclamation mark with the following error on one of those records: ReadOnly Data is Modified.

The query is as follows:

SELECT top 100
     app.fgm_grantprogrammeid
     , wkf.fgm_WorkflowId
FROM fgm_applicationgrant AS app
, fgm_workflow AS wkf  
WHERE app.fgm_grantprogrammeid = wkf.fgm_ProgramId
AND wkf.fgm_workflowid IN ('{596ddbc5-7496-ea11-a812-000d3a794f5d}', '{8ad95152-0dab-4074-80fb-c2bf13475ca9}')

If I run it as is it will display the following image

When I comment out wkf.fgm_WorkflowId from the Select it returns 100 records image

Using the Convert function produces the following FetchXML, which when run will return 100 records:

<fetch xmlns:generator='MarkMpn.SQL4CDS' top='100'>
  <entity name='fgm_applicationgrant'>
    <attribute name='fgm_grantprogrammeid' />
    <attribute name='fgm_applicationgrantid' />
    <link-entity name='fgm_workflow' to='fgm_grantprogrammeid' from='fgm_programid' alias='wkf' link-type='inner'>
      <attribute name='fgm_workflowid' />
      <filter>
        <condition attribute='fgm_workflowid' operator='in'>
          <value>{596ddbc5-7496-ea11-a812-000d3a794f5d}</value>
          <value>{8ad95152-0dab-4074-80fb-c2bf13475ca9}</value>
        </condition>
      </filter>
      <order attribute='fgm_workflowid' />
    </link-entity>
    <order attribute='fgm_applicationgrantid' />
  </entity>
</fetch>

I am currently on the latest version (9.0.1) I think a recent update has caused this issue.

SpaceManMat commented 3 months ago

Just saw #479 this looks like the same or a related issue

MarkMpn commented 3 months ago

Thanks for the details, this does look like a duplicate of #479 so I'm closing this one now.