is record in index

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

is record in index

Post by ecos »

Hi everybody,

after only 30 years of programming in clipper, VO and x# I have a beginner's question:

Is there a simply way to determine, if the current record is part of a conditional index, maybe even with scopes set ?
I used (orderkeyno()<>0) so far, but this gets extremely slow with big tables.

TIA
Karl
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: is record in index

Post by robert »

Karl,
You can get the index condition and macro compile and evaluate it
And then you can get the index key value and the current top and bottom scopes and compare that value with the current scopes (if any)

- DbOrderInfo(DBOI_CONDITION) for the condition
- DbOrderInfo(DBOI_KEYVAL) for the current keyvalue
- DbOrderInfo(DBOI_SCOPEBOTTOM) and DbOrderInfo(DBOI_SCOPETOP) for the scopes

see https://www.xsharp.eu/runtimehelp/html/ ... erInfo.htm for other possible DBOI_ values

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ecos
Posts: 103
Joined: Tue Nov 10, 2015 6:49 am
Location: Germany

Re: is record in index

Post by ecos »

Hi Robert,
that's exactly what I intended to do after the customer has complained about performance.
I just wondered whether there is a (maybe hidden) method/function for this i didn't know about...

Karl
Post Reply