DO WHILE .T.
CUSTDBF := "TEMP"+(SUBSTR(TIME(),7,2)+SUBSTR(TIME(),4,2))//+".DBF"
IF .not. FILE( xVol+"\DBTMP\"+CustDbf+".DBF" )
EXIT
ENDIF
ENDDO
DBF_STRU := { }
AADD( DBF_STRU, { "CustID", "C", 15, 0 } )
AADD( DBF_STRU, { "SceisId", "C", 21, 0 } )
AADD( DBF_STRU, { "CustName", "C", 50, 0 } )
AADD( DBF_STRU, { "CustAdd1", "C", 50, 0 } )
AADD( DBF_STRU, { "CustCity", "C", 35, 0 } )
AADD( DBF_STRU, { "CustState", "C", 2, 0 } )
AADD( DBF_STRU, { "CustZip", "C", 30, 0 } )
AADD( DBF_STRU, { "CustPh", "C", 15, 0 } )
AADD( DBF_STRU, { "CustCont", "C", 36, 0 } )
AADD( DBF_STRU, { "CustMail", "C", 50, 0 } )
Try
DBCREATE( xVol+"\DBTMP\"+CUSTDBF+".DBF", DBF_STRU )
Catch
Saying := "Sorry .. Error Creating"+chr(10)
Saying += xVol+"\DBTMP\"+CUSTDBF+".DBF"+chr(10)
Saying += "Please seek your Administrator"+chr(10)
MsgInfo( Saying )
CLOSE DATABASES
FERASE( xVol+"\DBTMP\"+CustDbf+".DBF")
FERASE( xVol+"\DBTMP\"+CUSTDBF+".CDX")
oDlg:END()
RETURN(NIL)
End Try
SELECT 9
IF NETUSE( xVol+"\DBTMP\"+CustDbf+".DBF", .T.,5)
Index on CustName TAG CustName
Set Order to Tag CustName
ELSE
CLOSE DATABASES
FERASE( xVol+"\DBTMP\"+CustDbf+".DBF")
FERASE( xVol+"\DBTMP\"+CUSTDBF+".CDX")
oDlg:END()
RETURN(NIL)
ENDIF
Select 9
DATABASE oDbf
xBrowse( oDbf ) // this works and I can pass oDbf to various other functions .. my next step is to simulate an incremental search ..
//---------------------------------------- incramental code
REDEFINE GET oName var cName ID 130 of oGrps ;
When nRad = 1 ;
ON CHANGE ( _Isearch( oName, cName, oCid, cCid, oSid, cSid, oLbx, oDbf )) UPDATE // , oRsCust )) UPDATE
REDEFINE GET oCid var cCid ID 131 of oGrps ;
When nRad = 1 ;
ON CHANGE ( _Isearch( oName, cName, oCid, cCid, oSid, cSid, oLbx, oDBf )) UPDATE //, oRsCust )) UPDATE
REDEFINE GET oSId var cSId ID 118 of oGrps ;
When nRad = 1 ;
ON CHANGE ( _Isearch( oName, cName, oCid, cCid, oSId, cSId, oLbx, oDBf )) UPDATE //, oRsCust )) UPDATE
REDEFINE GET oInv var cInv ID 140 of oGrps ;
When nRad = 2 ;
ON CHANGE ( _Isearch1( oInv,cInv,oLbxB,oRsInv,oRsCust,nRad,oLbx,oDbf )) UPDATE
//-------------------------------------------------------------------------------------------
Static Func _Isearch( oLname1, cLname1, oCid1, cCid1, oSceis1, cSceis1, oLbx, oDbf ) //, oRsCust )
cLname1 := alltrim( oLName1:GetText() )
cCid1 := alltrim( oCid1:GetText() )
cSceis1 := alltrim( oSceis1:GetText() )
msginfo( cLname1 )
xbrowse(oDbf)
Do Case
Case (Empty( cLName1 ) .and. Empty( cCid1 ) .and. Empty( cSceis1) )
Set Scope To ( 'bogus' ) // resets browse
* oRsCust:Filter := "[CustomerName] = 'bogus'"
Case !empty( cLname1 ) .and. Empty( cCid1 ) .and. Empty( cSceis1 )
Set Scope to ( cLname1 ) // attempting this ??????????????????????????????????????????????? line 709
* oRsCust:Filter := "[CustomerName] like '"+cLname1+"%'"
// ------ old ado code
Case (!empty( cLname1 ) .and. !Empty( cCid1 ) .and. Empty( cSceis1 ))
oRsCust:Filter := "[CustomerName] like '"+cLname1+"%' and [CustomerId] like '"+cCid1+"%'"
Case empty( cLname1 ) .and. !Empty( cCid1 ) .and. Empty( cSceis1 )
oRsCust:Filter := "[CustomerId] like '"+cCid1+"%'"
Case ( Empty( cLName1 ) .and. Empty( cCid1 ) .and. !Empty( cSceis1) )
oRsCust:Filter := "[SceisId] like '"+cSceis1+"%'"
OtherWise
oRsCust:Filter := "[CustomerName] = 'bogus'"
End Case
oLbx:ReFresh()
Return(.t.)
SELECT 9
IF NETUSE( xVol+"\DBTMP\"+CustDbf+".DBF", .T.,5)
Index on CustName TAG CustName
Set Order to Tag CustName
ELSE
CLOSE DATABASES
FERASE( xVol+"\DBTMP\"+CustDbf+".DBF")
FERASE( xVol+"\DBTMP\"+CUSTDBF+".CDX")
oDlg:END()
RETURN(NIL)
ENDIF
Select 9
DATABASE oDbf
oCustomers:= TDatabase():New(, xVol+"\DBTMP\"+CustDbf.DBF")
oCustomers:use()
msgInfo(oCustomers:XXX) // where XXX is a valid fieldname
Static Func _Isearch( oLname1, cLname1, oCid1, cCid1, oSceis1, cSceis1, oLbx, oDbf )
REDEFINE GET oName var cName ID 130 of oGrps ;
When nRad = 1 ;
ON CHANGE ( _Isearch( oName, cName, oCid, cCid, oSid, cSid, oLbx, oRsCust )) UPDATE
REDEFINE GET oCid var cCid ID 131 of oGrps ;
When nRad = 1 ;
ON CHANGE ( _Isearch( oName, cName, oCid, cCid, oSid, cSid, oLbx, oRsCust )) UPDATE
REDEFINE GET oSId var cSId ID 118 of oGrps ;
When nRad = 1 ;
ON CHANGE ( _Isearch( oName, cName, oCid, cCid, oSId, cSId, oLbx, oRsCust )) UPDATE
REDEFINE GET oInv var cInv ID 140 of oGrps ;
When nRad = 2 ;
ON CHANGE ( _Isearch1( oInv,cInv,oLbxB,oRsInv,oRsCust,nRad,oLbx )) UPDATE
...
...
...
//-------------
Static Func _Isearch( oLname1, cLname1, oCid1, cCid1, oSceis1, cSceis1, oLbx, oRsCust )
cLname1 := alltrim( oLName1:GetText() )
cCid1 := alltrim( oCid1:GetText() )
cSceis1 := alltrim( oSceis1:GetText() )
Do Case
Case (Empty( cLName1 ) .and. Empty( cCid1 ) .and. Empty( cSceis1) )
oRsCust:Filter := "[CustomerName] = 'bogus'"
Case !empty( cLname1 ) .and. Empty( cCid1 ) .and. Empty( cSceis1 ) // here
oRsCust:Filter := "[CustomerName] like '"+cLname1+"%'"
Case (!empty( cLname1 ) .and. !Empty( cCid1 ) .and. Empty( cSceis1 ))
oRsCust:Filter := "[CustomerName] like '"+cLname1+"%' and [CustomerId] like '"+cCid1+"%'"
Case empty( cLname1 ) .and. !Empty( cCid1 ) .and. Empty( cSceis1 )
oRsCust:Filter := "[CustomerId] like '"+cCid1+"%'"
Case ( Empty( cLName1 ) .and. Empty( cCid1 ) .and. !Empty( cSceis1) )
oRsCust:Filter := "[SceisId] like '"+cSceis1+"%'"
OtherWise
oRsCust:Filter := "[CustomerName] = 'bogus'"
End Case
oLbx:ReFresh()
Return(.t.)
(::cAlias )->(OrdsetFocus("Fetcha")) .. the use of OrdScope ?? in tDatabase ..
Case !empty( cLname1 ) .and. Empty( cCid1 ) .and. Empty( cSceis1 )
Set Scope to ( cLname1 ) // attempting this ??????????????????????????????????????????????? line 709
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 110 guests