xBrowse LookUp

xBrowse LookUp

Postby Mulyadi » Tue Feb 26, 2013 4:46 am

Hi All,

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

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

/*
   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
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: xBrowse LookUp

Postby Mulyadi » Tue Feb 26, 2013 9:01 am

Mr. Nages.....?
Help me please.....
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: xBrowse LookUp

Postby nageswaragunupudi » Tue Feb 26, 2013 12:27 pm

I have a problem in the incremental search with RecordSet. if using Array or DBF file with mall record. this program is not problem.

You are right.
A small bug has crept in versions 12.12 to 13.02 in Incremental Seek of ADO only.
Please make this correction.

Please locate these lines in the xbrowse.prg
Code: Select all  Expand view
METHOD AdoIncrSeek( uSeek ) CLASS TXBrowse

   local lFound   := .f.
   local cCol     := StrToken( ::oRs:Sort, 1 )
 


Please make this correction
Code: Select all  Expand view
METHOD AdoIncrSeek( uSeek ) CLASS TXBrowse

   local lFound   := .f.
   local cCol     := CharRem( "[]", StrToken( ::oRs:Sort, 1 ) ) // CORRECTION
 

After making this correction, please compile xbrowse.prg and link directly with your application.

Please let us know the results.
This is fixed in version 13.03.

version in file Fivewin.ch is 13.02, but if I get error in my code, the error show version : 12.08..

Most likely your compile script may be referring to the old fwh\include folder of 12.08 version. Please check your compilation environment and settings.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10642
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse LookUp

Postby Mulyadi » Wed Feb 27, 2013 4:34 am

Mr. Nages

Many Thanks..

Incremental Search with ADO:
with corrected that:
1. in the case with Incrementas Search, at least be helpedful effort.
before now, every we Click in the Column Header an then we typing a text to searhcing, as a result is Error.
and now this case is not error.

2. the next Problem is: if we typing a text and then the text is not found in the criteria, so the XBROWSE resulted a Blank Rows
and movement cursor is leaving off, with that BackSpace key not function
.

VERSION:
some day ago, I just buy version 13.02 and I dont have 12.08.. :)


XBROWSE Problem: Implementation from source code: XBINCFLT.PRG ( FWH\SAMPLES )

I already test with Array, Dbf and ADO(Oracle 10g.), the result like this:
1. just for display record direct from recordset for small or larget table, can be fast and quick.
2. searching:
- small record, the result is no problem. movement cursor fast and quick.
- large record like 50000 or up, movement cursor at typing seeking for is very slow.

NOW I applying and already migration to Oracle Database, not DBF file like previous.
DBF file just good for small record, if we have a record database is so big, DBF very many many many problem.. :)
like DBF or Index file Corrupted, 'record not found' but actually the case is be present. etc.... :)

Thanks for helpfull effort and I waiting furthermore and when I be able to download 13.03...? :)


Mulyadi
mrmulyadi32@gmail.com
Indonesia

FWHX 13.02, BCC582.
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: xBrowse LookUp

Postby nageswaragunupudi » Wed Feb 27, 2013 8:02 am

Good decision to move to Oracle.
I had experience in development of software with FWH+xHarbour+Oracle for a very large organisation.

One thing we should keep in mind while moving away from DBF ( or ADS ) to any other RDBS is that we can never have the comfort of browsing very large tables.
For example, we can comfortably offer browse of a million row table with ADS (DBF or ADT) but is just not possible with Oracle (or any similar RDBMS).

We need to manage with smaller and manageable subsets of the table for browses. You will yourself see when you go along.

You may notice that you will not find the kind of browses (grids) that we (clipper/harbour programmers) provide in the software prepared by others.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10642
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 77 guests