Sorry with my english.
To Mr.Antonio, or Mr. Nages
2 day ago, I has download FTDN (FWH 13.02)
the version in file Fivewin.ch is 13.02, but if I get error in my code, the error show version : 12.08..
- Code: Select all Expand view RUN
Application
===========
Path and name: e:\KSK12\flookup.exe (32 bits)
Size: 2,220,032 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9656)
FiveWin Version: FWHX 12.08
Windows version: 6.1, Build 7600
I have a problem in the incremental search with RecordSet. if using Array or DBF file with mall record. this program is not problem.
My problem like this:
database: Oracle, table containing 172,212 records.
I want to create lookup table from RecordSet.
if i just press Up, Down, PgUp, PgDn the browse is normal,
but if I type a word like '20.2' or a 'desctription' , the result like delayed and if I press BackSpace, the dialog is not respons... and then... BLANK BROWSE..
my code like this, i get it from FWH\Samples, just litle change.
- Code: Select all Expand view RUN
/*
fLookUp.prg
*/
#include "FiveWin.ch"
#include "xbrowse.ch"
function tbl_ackode( nnTop, nnLeft )
local oDlg, oBrw, oFont, nWild := 2
local cList, aFlds, aHdrs
local nTop, nLeft, nBott, nRight
local lRet := .F., osay1, osay2
local get_data, ckode, cket, clvl, cgd, cdk
local oRsAcct := open_rs()
nTop := if( empty( nnTop ), 150, nnTop )
nLeft := if( empty( nnLeft ), 150, nnLeft )
nBott := nTop + 450
nRight := nLeft + 750
ofont := TFont():New("Segoe UI Light",,-12, .F.,.F.,,,,.F.)
DEFINE DIALOG oDlg ;
FROM nTop, nLeft TO nBott, nRight PIXEL ;
STYLE nOr( DS_MODALFRAME, WS_POPUP ) ;
COLOR CLR_WHITE, RGB( 90, 200, 190 ) ;
FONT oFont
cList := "KODE,PERKIRAAN,LVL,GD,DK,REFF"
aFlds := aHdrs := HB_ATokens( cList, ',' )
@ 34,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
COLUMNS aFlds HEADERS aHdrs ;
RECORDSET orsAcct AUTOCOLS AUTOSORT CELL LINES NOBORDER ;
ON DBLCLICK ( eval( get_data ) ,;
lRet := .T., ;
oDlg:end() )
get_data := {|| ckode := oBrw:aRow[1] ,;
cket := oBrw:aRow[2] ,;
clvl := oBrw:aRow[3] ,;
cgd := oBrw:aRow[4] ,;
cdk := oBrw:aRow[5] }
WITH OBJECT oBrw
with object oBrw:aCols[1]
:nWidth := 80
end
with object oBrw:aCols[2]
:nWidth := 200
end
with object oBrw:aCols[3]
:nWidth := 50
end
with object oBrw:aCols[4]
:nWidth := 80
end
with object oBrw:aCols[5]
:nWidth := 80
end
:lIncrFilter := .T.
:lSeekWild := ( nWild == 1 )
:cFilterFld := "KODE"
:nStretchCol := STRETCHCOL_WIDEST
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nMarqueeStyle := 5
:lRecordSelector := .F.
:lHScroll := .T.
:lVScroll := .T.
:bKeyDown := {|nKey| if( nKey == VK_RETURN, ( eval( get_data ) , lRet := .T. , oDlg:end() ), nil ) }
END
@ 2, 10 SAY osay1 PROMPT "Filter:" SIZE 140,10 PIXEL OF oDlg COLOR CLR_YELLOW, RGB( 90, 200, 190 )
@ 10, 10 COMBOBOX oBrw:cFilterFld ;
ITEMS aHdrs ;
ON CHANGE ( oBrw:Seek( "" ), oBrw:SetFocus() ) ;
SIZE 50,400 PIXEL OF oDlg
@ 2, 70 SAY osay2 PROMPT "Desc..." SIZE 140,10 PIXEL OF oDlg COLOR CLR_YELLOW, RGB( 90, 200, 190 )
@ 10, 70 COMBOBOX nWild ITEMS { "Start from...", "Containing..." } ;
ON CHANGE ( oBrw:lSeekWild := ( nWild == 1 ), ;
oBrw:Seek( If( oBrw:lSeekWild, oBrw:cSeek, "" ) ), ;
oBrw:SetFocus() ) ;
SIZE 70,400 PIXEL OF oDlg
@ 24,10 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 140,10 PIXEL ;
OF oDlg COLOR CLR_WHITE,RGB( 90, 200, 190 ) PICTURE '@!'
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg ON INIT ( oBrw:SetFocus(), .f. )
RELEASE FONT oFont
return { lRet, ckode, cket, clvl, cgd, cdk }
* my table is in acct schema
*
static func open_rs()
local ores, csql, oCon, cstring, txtPTLokasi := "001007"
cString := "Provider=OraOLEDB.Oracle;Data Source=orcl;User ID=system;Password=itboss"
CursorWait()
oCon := CREATEOBJECT( "ADODB.Connection" )
TRY
oCon:Open( cString )
CATCH
msgalert("Error connection to Oracle")
Cursor()
quit
END TRY
csql := "select acct.ackode.kode, acct.ackode.ket as Perkiraan, acct.ackode.lvl, " + ;
"case when acct.ackode.gd = 'G' then 'General' else 'Detail' end as GD, " + ;
"case when acct.ackode.dk = 'D' then 'Debet' else 'Kredit' end as DK, " + ;
"acct.ackode.reff, acct.acgroup.ket as ket_group " + ;
"from acct.ACKODE " + ;
"inner join acct.acgroup on acct.acgroup.kode = acct.ackode.grp " + ;
"where acct.ackode.aktif = 'Y' and acct.ackode.ptlokasi = '"+txtPTLokasi+"' " + ;
"order by kode"
Try
ores := FW_OpenRecordSet( oCon, cSql )
Catch
msgalert("Error opening RecordSet")
quit
End try
*
* RecordSet: KODE | PERKIRAAN | LVL | GD | DK | REFF | KET_GROUP
* ----------------------------------------------------
* 00001 test 1 General Debet test
* 00002 test 2 General Debet 0001 test
* 00003 test 3 General Debet 0002 test
* ...
*
* total record : 172,212 records.
*
return ores
I thing in older version, my code for lookup table is not problem...
some one can help me....?
Mulyadi.
mrmulyadi32@gmail.com
Indonesia.
FWHX: 13.02