Searching by key within a range

Hi,

I have an application I’m building where people can order quantities of products, and the price per product varies depending on the quantity. The price variations occur at specific quantity amounts; ie 100, 500, 1000 etc.

Each of the quantity ranges is set up as a response document to the product document.

What I need to be able to do is to find out which of the response documents contains the correct range for an amount entered in as an order.

The only way I can think of doing it currently is to find the parent and then step through the responses doing a comparison until I find it. Does anyone have any better suggestions?

Subject: Searching by key within a range

You could try something like running a full text search via a Set notesDocumentCollection = notesDatabase.Search( formula$, notesDateTime, maxDocs% ) and Select statement.

ie formula$ = “SELECT (Product =” & chr(32) & doc.productname(0) & chr(32) & “) & (” & doc.quantity(0) & " >= 499) & (" & doc.quantity(0) & " <= 100)"

Not sure about the syntax but this should get you started.

Subject: RE: Searching by key within a range

I suspect that that would take longer than stepping through the documents, given that I can categorize on the product first. But thanks for taking the time to think about it for me :slight_smile: