move in DBFCDX orders to speed up filters

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
User avatar
wriedmann
Posts: 3759
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

move in DBFCDX orders to speed up filters

Post by wriedmann »

Hello,
in order to speed up filter in DBFCDX (both in VO and later in X#), I would like to process only the orders.
To explain it better: I would like to read only the order, without move the record pointer in the DBF, and build a in-memory array of the order values, and then use this array to build filters.
Unfortunately I have not found any function that lets me do that....
Any help would be very welcome!
Wolfgang
P.S. if in VO such things are not available, but in the X# RDD, this would be another reason to move to X# (and something I could "sell" to my customers).
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

move in DBFCDX orders to speed up filters

Post by robert »

Wolfgang,
This is doable.
I might be able to define a special DBOI_ value to retrieve the list of recno - keyvalue pairs for an index or for a part of an index (if you have set a scope first).
The key values would be represented as byte arrays, and for numeric and date keys these would be encoded just like FoxPro encodes them.
The CDX keys are all stored in Leaf pages. See https://github.com/X-Sharp/XSharpPublic ... afPage.prg
I could return a list of a subset of the fields inside CLASS CdxLeaf that you can find in that page. I don't think you need the other properties from that class.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3759
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

move in DBFCDX orders to speed up filters

Post by wriedmann »

Hi Robert,
that would be great!
Wolfgang
P.S. the implicit answer is then that VO cannot do that.... but it seemed to me that Clipper 5.3 could do something like this
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3759
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

move in DBFCDX orders to speed up filters

Post by wriedmann »

Hi Robert,
another question: the X# RDD currently supports custom orders?
It is ages that I have not used them, but I think I could need them, combined with the order seek.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

move in DBFCDX orders to speed up filters

Post by Karl-Heinz »

Hi Wolfgang,

X# recognizes a VO created custom order and you can already create with X# a custom order, but OrdKeyAdd() and OrdKeyDel() are not working yet. i just tried it in my test app and it still fails..

Code: Select all

METHOD PshAddToCustomOrder() 


//	IF DbOrderInfo ( DBOI_KEYADD , , "Order3" )
		
	IF SELF:server:OrderKeyAdd ( "Order3" ) 		
		
		MsgInfo ( "'" + AllTrim ( SELF:server:FIELDGET ( #last )) + "' added to Custom order 'ORDER3' " ) 
		
		
	ELSE 
		 MsgInfo ( "OrderKeyAdd() failed" ) 
		
	ENDIF 
	
	RETURN SELF 

I searched in GitHub and found this in the DbfCdx.prg. Maybe it's on the way ;-)

Code: Select all

                CASE DBOI_KEYADD
                    IF workOrder != NULL
                        info:Result := workOrder:AddKey(SELF:Recno)
                    ELSE
                        info:Result := FALSE
                    ENDIF
                CASE DBOI_KEYDELETE
                    IF workOrder != NULL
                        info:Result := workOrder:DeleteKey(SELF:Recno)
                    ELSE
                        info:Result := FALSE
                    ENDIF. 
regards
Karl-Heinz
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

move in DBFCDX orders to speed up filters

Post by robert »

Wolfgang,
VO (and Vulcan) both have the support to manipulate what is called "RecordLists" inside the CDX RDD.
It has never been documented and brought to the surface.
If you look in volibSyslibRDD.PRG you will find a commented out section with DBI_RL_ defines and functions that start with Rl().
You could use this in VO to create recordlists or retrieve the internal recordlist created by the RDD . rlNewQuery() would take an expression and get it evaluated by the RDD and return a new recordlist, there are functions to mark a record as set or cleared in the recordlist and rlNextRecNo() and rlPrevRecNo() find the next and previous record in the recordlist . You can also created multiple recordlists and And or Or them to combine the selected records.

"YouKnowWho" decided that we should not "Unlock" this. You can imagine that MrData would have wanted to do so.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

move in DBFCDX orders to speed up filters

Post by robert »

Wolfgang,
wriedmann wrote: another question: the X# RDD currently supports custom orders?
It is ages that I have not used them, but I think I could need them, combined with the order seek.
This is on my todo list. And like Karl discovered, there is partial support for this in the RDD layer but not yet in the Tag layer.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3759
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

move in DBFCDX orders to speed up filters

Post by wriedmann »

Hi MrData,

thank you very much for your anser(s)!

I don't have any doubts your todo list is huuuuge <g>.
And I was thinking we could start collecting money for the DBFServer product <g>....

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply