It looks like a can not do what I wanted to do.
...
From here I can work all the information I need into one temp table.
I am just worried about how fast this can work on large tables.
...
Realmente no entendí lo que deseabas hacer ni la razón, ni que tan grandes sean tus tablas...
Pero yo lo haría de la siguiente manera...(Según tu ejemplo)
---------------------------------------------------------------------
I really did not understand what you wanted to do or why, or how big your tables ...
But I would do it as follows ... (In your example) ...
Code: Select all
#include <hmg.ch>
FUNCTION MAIN
tbls()
USE INV INDEX NUM1
DEFINE WINDOW Form_1 AT 0,0 WIDTH 500 HEIGHT 480 Main on release DBCloseALL() TITLE 'DBEVAL() Test WITH 500,000 regs.!!! By AndyGlezL'
@ 005,010 BUTTON Button_2 CAPTION ' SEARCH' WIDTH 75 HEIGHT 20 ;
TOOLTIP 'Add New Item:' ACTION ADD()
@ 005,180 LABEL LB_1 VALUE "" WIDTH 300 HEIGHT 20 FONT 'Verdana' SIZE 10 FONTCOLOR RED BOLD
@ 030,010 GRID Grid_Search OF Form_1 WIDTH 465 HEIGHT 420 FONT 'Verdana' SIZE 9 ;
HEADERS { "NUM1", "DESC", "NUM3" } WIDTHS { 100, 180, 120 }
END WINDOW
form_1.Center
form_1.Activate
RETURN
function tbls
LOCAL CF := {}
if ! file('inv.dbf')
aADD(CF,{'NUM1' ,'C' , 15,0})
aADD(CF,{'DESC' ,'C' , 25,0})
aAdd(CF,{'NUM2' ,'C' , 25,0})
aAdd(CF,{'NUM3' ,'C' , 25,0})
DBCREATE( 'INV.DBF',CF )
USE INV EXCLUSIVE NEW
do while recno()< 500000 // 500,000 Regs !!!!!!!!!!!!
Inv->( DBAPPEND())
Inv->( FIELDPUT(1, 'P' +ALLTRIM(STR(20+RECNO() ))) )
Inv->( FIELDPUT(2, 'DESC' +ALLTRIM(STR(20+RECNO() ))+CMONTH(DATE() + Random( 12 ) ) ) )
Inv->( FIELDPUT(3, 'N2' +ALLTRIM(STR(20+RECNO() ))) )
Inv->( FIELDPUT(4, 'N3' +ALLTRIM(STR(20+RECNO() ))) )
LOOP
enddo
INDEX ON NUM1 TO NUM1
endif
return
FUNCTION Add( )
Form_1.LB_1.Value := TIME() + " / "
Inv->( DBEVAL( {|| IF( SUBSTR( NUM1, 1, 2 ) == "P2" .AND. "Oct" $ DESC, ; // Condition
Domethod( "Form_1","Grid_Search","AddItem", { Inv->NUM1, Inv->DESC, Inv->NUM3 } ), ; // Action
nil ) } ) )
Form_1.LB_1.Value := Form_1.LB_1.Value + TIME() + " Regs: " + STR( Form_1.Grid_Search.ItemCount )
RETURN nil
1 minuto 14 segundos para leer 500,000 registros y seleccionar 78,281
-------------------------------------------------------------------------------------
1 minute 14 seconds to read 500,000 records and select 78,281