SData2 Query won't work with startindex at anything other than 1

I have an SData2 query that works fine for the first page of the pagination, but gives me a bad request for any query where startindex doesn't equal 1.

The query is:

opportunity?where=oppo_mydatefield%20ge%20@2016-09-01@%20and%20oppo_mydatefield%20le%20@2016-09-30@&startindex=1&count=10

I have tried startindex = 11 and startindex = 2.

I have confirmed the $next parameter in the response is:

opportunity?where=oppo_mydatefield%20ge%20@2016-09-01@%20and%20oppo_mydatefield%20le%20@2016-09-30@&startindex=11&count=10

Any ideas?

  • 0

    Does this vary whether you are working without a 'where' clause? Or using a non-date where clause?

  • 0

    Good question!

    I get the same error without a where clause at all. But again not for the first page of the results.

  • 0

    Hmmmm

    I have tried with variants requests against the SData 1.1 endpoint

    e.g

    localhost/.../company

    This has (to my eyes) worked as expected.

    I have tried with variants requests against the SData 2.0 endpoint

    localhost/.../opportunity

    But I get like you 400 errors and a diagnoses returned.

    Looking in the logs (20160919sdata2.log) I see

    Caused by: org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [SELECT * FROM (SELECT oppo_opportunityId, Oppo_Deleted, Oppo_product, oppo_scenario, oppo_SCRMwinner, Oppo_WorkflowID, oppo_NoDiscAmtSum_CID, Oppo_TimeStamp, Oppo_CreatedDate, oppo_NoDiscAmtSum, Oppo_NotifyTime, Oppo_Description, Oppo_DecisionTimeFrame, oppo_TotalOrders_CID, Oppo_CreatedBy, Oppo_Stage, Oppo_SCRMIsCrossSell, Oppo_PrimaryAccountId, oppo_SCRMcompetitor, Oppo_Certainty, Oppo_Priority, Oppo_UpdatedDate, oppo_totalQuotes_CID, Oppo_Status, Oppo_Forecast, Oppo_LeadId, Oppo_type, oppo_secterr, Oppo_ChannelId, Oppo_Forecast_CID, oppo_SCRMreasonforloss, Oppo_AssignedUserId, Oppo_Note, oppo_totalQuotes, oppo_smssent, Oppo_Total_CID, Oppo_PrimaryPersonId, oppo_Currency, Oppo_Deleted, Oppo_Total, oppo_closed, Oppo_Source, oppo_targetclose, oppo_TotalOrders, Oppo_PrimaryCompanyId, Oppo_UpdatedBy, Oppo_OpportunityId, Oppo_WaveItemId, Oppo_customerref, Oppo_SCRMOriginalOppoId, Oppo_Opened, Oppo_Deleted, ROW_NUMBER() OVER(ORDER BY oppo_opportunityId) AS rowranking FROM opportunity WITH (NOLOCK) WHERE Oppo_Deleted IS NULL) AS A WHERE rowranking >= 2 and rowranking < 3]; The column 'Oppo_Deleted' was specified multiple times for 'A'.; nested exception is java.sql.SQLException: The column 'Oppo_Deleted' was specified multiple times for 'A'.

    So I think perhaps something may be wrong with the way in which deleted records are excluded from searches.

    I'll bring this to the attention of my colleagues in Development BUT SData2.0 is not a supported feature so I am not sure what my support colleagues will say.

  • 0

    It is supported in Cloud but it is not yet with on-premise.

  • 0

    Thanks Jeff.

    I didn't realise that SData2 is unsupported. Presumably it is something that will be supported at some point in the future?

    The reason I tried SData2 is because I'm getting duplication of results due to pagination in my SData1 query, as posted here:

    community.sagecrm.com/.../13111.aspx