invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

Filter sales order lines by date or item ID

Replies happen on the forum.

Go to source

Question

We have roughly 1000 orders per month, and I want to quickly search the order lines for a specific item that’s been sold recently.

At the moment, it retrieves all the rules from SnelStart, and that takes too long.

I want these two filters to be passed on to SnelStart:

select *
from   verkooporderregels
where  datum >= trunc(sysdateutc)
and    artikel_id = newid()

It’s currently using:

https://b2bapi.snelstart.nl/v2/verkooporders?$top=500

An example is request 0HNPQE2N595PU:00000001 with the query:


select t.[nummer], t.[datum], t.[omschrijving_2], t.[relatie_id], t.[afleveradres_postcode], t.[afleveradres_land_id], t.[factuuradres_land_id], t.[verkoopordersjabloon_id], t.[omschrijving], t.[aantal], t.[totaal], t.[verkoopfactuur_id], t.[procesStatus]
from   SnelStart.Verkooporders.VerkoopOrderRegels@snr t
where  [modifiedOn] >= :w1 and [artikel_id] = :w2

This returns 13 rows, but fresh API rows are 21310 with a runtime of 3 minutes.

How can I set up that filter?

Accepted answer

A new release is available which should resolve this issue. The necessary changes are available from release 27.0.74 and in all future BETA versions.

This new release is/will be deployed to production on Invantive Cloud.

For further information, see:

Query:

select *
from   verkooporderregels
where  datum >= trunc(sysdateutc)
and    artikel_id = to_guid('54dbba2d-4765-4057-bcdd-023159889a7b')

The actual API call now also filters on the deeper level:

https://b2bapi.snelstart.nl/v2/verkooporders?$top=500&$filter=Datum+ge+datetime%272026-11-04T00%3A00%3A00%27+and+Regels%2Fany%28r%3Ar%2FArtikel%2FId+eq+guid%2754dbba2d-4765-4057-bcdd-023159889a7b%27%29

Reply 3

Does this happen automatically, or do you need to do something to make it work? I am new here, so I am not yet very familiar with Invantive.

Reply 4

For the Invantive MCP Server (for use with AI) this continues automatically. Performance should now be better when retrieving data as described.

Reply 5

This question was automatically closed after 1 week of inactivity. The last answer provided has been marked as the solution.

Please ask a new question in a separate thread if the problem reoccurs. Please include a link to this thread in the new question by pasting its URL into the text.

Reply on the forum