cancel
Showing results for 
Search instead for 
Did you mean: 

CAP External service limit 1000 rows

smorenod
Explorer

Hi experts !

I'm trying to do this query to an external service (on database this service has 4500 records):

 let updateLocation = await tx.run(SELECT.from(location_sync));

But in updateLocation I only have 1000 rows and not 4500. I tried to delete SELECT.limit on my srv.BEFORE ('READ') method, but it doesn't work.

I tried with SELECT.from(location_sync).limit(999999) but it didn't work as well.

Any idea??

Thank you all in advance.

david_kunz2
Advisor
Advisor

Hi,

Looks like your external service is configured to have a maximum number of rows.
You can use the `limit.offset` property to skip entries.

Best regards,
David

smorenod
Explorer
0 Kudos

Hi David.

Thanks for your answer 🙂

I configured the external service and there's no limit this is the entity.cds:

entity location_sync {
    key Werks : String(4);
    key Stand : String(10);
        Ktext : String(40);
}

<br>

And the service.cds:

service SyncData @(requires_ : 'authenticated-user') {

entity location_sync          as projection on AssecSync.location_sync;

}
0 Kudos

+1, we have the same issue in our project. We have a custom Node.js OData v4 service implementation, and when we introspect an incoming query it always has limit=1000 when $top is not specified.

Accepted Solutions (1)

Accepted Solutions (1)

david_kunz2
Advisor
Advisor

Hi,

The answer is here. You can configure the max items your server is able to provide.

Best regards,
David

virengupta
Discoverer
0 Kudos

david.kunz2 : I face exactly the same problem, and even after configuring the limit as mentioned in the link you mentioned, the underlying external oData service still returns 100 records.

Also, I have checked in debug mode, srv.tx(req).run(query) : req -> query ->SELECT->limit->rows has value 10000 (as set in configuration).

Any hints how to fix?
Thanks!

------------ EDIT --------------

upon further debugging found "req" has the limit attribute with the set value from config, but "query" was missing the limit attribute - setting that to the same value from config & running the transaction, it returns 5000 records - but it is still less than the value set!

Could 5000 be the maximum return value in the framework?

david_kunz2
Advisor
Advisor
0 Kudos

Hi guptaviren ,
Did you configure your own service (entity) to have this limit? If, yes, then req.query should have the correct limit. Note: External services might have an intrinsic limit which is beyond your control.

Answers (1)

Answers (1)

Hi Sara,

Looks like the default max pagination. Have you tried to change the maximum limit?


@cds.query.limit.max: 5000
service SyncData {
  entity location_sync ...

}
radusimendevel
Discoverer
0 Kudos

We have to mention the fact that this annotation does not work on the remote-services that were imported because the backend remote service enforces the result limit, not the read from cds CqnService