Home > Software design >  Dataset Locate number within range
Dataset Locate number within range

Time:08-01

I have this dataset with the following data :

Winner Name Coupon Start Coupon End
Joshua 00001 00010
Mark 00011 00020
Stephen 00021 00024
Ina 00025 00025

I can easily using Locate to find for example the winner for coupon 00011 which is Mark, but how to find the winner for Coupon between (ie 00023 or 00007) using dataset.locate function

CodePudding user response:

You can't use Locate to find multiple values in they way that you've asked. You can use a filter, an SQL query, or perhaps even SetRange. This answer will focus on using TDataset's filter, which can be used as part of an SQL query.

You have to focus your filter with the Winning Ticket.

If the winning ticket is 7, then your filter should be:

(7 >= CouponStart) AND (7 <= CouponEnd)

Same for a winning ticket of 23

(23 >= CouponStart) AND (23 <= CouponEnd)
  • Related