In a D7 app, I need to derive the current range start and end key values at run time. I.e., there are situations where I pass a client dataset to a function that needs to save the state of the incoming dataset, including current index, filter, and setrange. There seems to be no straightforward property or method to get the range info from the dataset.
Something that seems to work, though it's really a kluge, is to call EditRangeStart/EditRangeEnd and read the values of the index keys into local variables. Normally, of course, you'd ASSIGN these values while in Setkey mode, but it appears you can read them too. The problem here is that I can't figure out how to take the dataset back out of Setkey state once I've read my values. The EditRangeStart/EditRangeEnd design assumes you're going to issue either a Cancelrange or an Applyrange once you've set your keys. Issuing an Applyrange works most of the time (though I suspect I'm incurring needless overhead), but sometimes does fail with a "Number is out of range" exception from the bowels of the VCL.
Either of two options would enable me to solve my problem:
1. A straightforward way of reading the setrange keys without going the EditRangeStart route
2. A way of canceling the Setkey state without Applyrange or Cancelrange, so I can use EditRangeStart safely.
Can anyone enlighten a poor soul?
Something that seems to work, though it's really a kluge, is to call EditRangeStart/EditRangeEnd and read the values of the index keys into local variables. Normally, of course, you'd ASSIGN these values while in Setkey mode, but it appears you can read them too. The problem here is that I can't figure out how to take the dataset back out of Setkey state once I've read my values. The EditRangeStart/EditRangeEnd design assumes you're going to issue either a Cancelrange or an Applyrange once you've set your keys. Issuing an Applyrange works most of the time (though I suspect I'm incurring needless overhead), but sometimes does fail with a "Number is out of range" exception from the bowels of the VCL.
Either of two options would enable me to solve my problem:
1. A straightforward way of reading the setrange keys without going the EditRangeStart route
2. A way of canceling the Setkey state without Applyrange or Cancelrange, so I can use EditRangeStart safely.
Can anyone enlighten a poor soul?