call toDbf() from xbrowser command line
Posted: Tue Nov 24, 2020 10:51 am
I want to call Xbrowser with extra functions...
I open the file, must change the colums (prefered with Xbrcolselector function to tag more than 1 field)
and than save the file with the selected fields.
Now it errors out...
Application
===========
Path and name: C:\Programmas\fotoselect\TEST.EXE (32 bits)
Size: 4,928,512 bytes
Compiler version: Harbour 3.2.0dev (r1506171039)
FiveWin version: FWH 19.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 16 secs
Error occurred at: 24/11/2020, 11:48:42
Error description: Error BASE/1003 Variable does not exist: CODE
Stack Calls
===========
Called from: => DBUSEAREA( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:TODBF( 10453 )
Called from: => (b)EVAL( 11635 )
Called from: .\source\classes\WINDOW.PRG => TCONTROL:RBUTTONDOWN( 2150 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:RBUTTONDOWN( 5178 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1801 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11223 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
Called from: .\source\function\XBROWSER.PRG => XBROWSE( 278 )
Called from: .\TEST1.PRG => CSVTRANSFORM( 11635 )
Called from: .\TEST1.PRG => (b)BUILDMENU( 5650 )
I open the file, must change the colums (prefered with Xbrcolselector function to tag more than 1 field)
and than save the file with the selected fields.
Now it errors out...
Application
===========
Path and name: C:\Programmas\fotoselect\TEST.EXE (32 bits)
Size: 4,928,512 bytes
Compiler version: Harbour 3.2.0dev (r1506171039)
FiveWin version: FWH 19.12
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 16 secs
Error occurred at: 24/11/2020, 11:48:42
Error description: Error BASE/1003 Variable does not exist: CODE
Stack Calls
===========
Called from: => DBUSEAREA( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:TODBF( 10453 )
Called from: => (b)EVAL( 11635 )
Called from: .\source\classes\WINDOW.PRG => TCONTROL:RBUTTONDOWN( 2150 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:RBUTTONDOWN( 5178 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1801 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11223 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
Called from: .\source\function\XBROWSER.PRG => XBROWSE( 278 )
Called from: .\TEST1.PRG => CSVTRANSFORM( 11635 )
Called from: .\TEST1.PRG => (b)BUILDMENU( 5650 )
Code: Select all
//xBrowser("hunt") SETUP (oBrw:bRclicked:={ |r,c,f,o| o:todbf("temp.dbf")})
xBrowser("&cDbf") SETUP (oBrw:bRclicked:={ |r,c,f,o| xbrowse(o), o:todbf("temp.dbf")})
//xBrowser("hunt") SETUP (oBrw:bRclicked:={ |r,c,f,o| XbrColSelector( o )})
//xBrowser("hunt") SETUP (oBrw:bRclicked:={ |r,c,f,o| XbrColSelector( oBrw ),o:todbf(cFile ,,,.t.)})
//xBrowser("hunt") SETUP (oBrw:bRClickHeaders:={|r,c,f,o| XbrColSelector( o ), o:todbf("hunt" ,,,.t.) } )
//oBrw:ToDbf( cFile, bProgress, aCols, lPrompt )
function XbrColSelector( oBrowse )
local oDlg, oBrw
local aSave := aCopy( oBrowse:aCols )
local cSavefile:="Temp.dbf"
DEFINE DIALOG oDlg SIZE 300,400 PIXEL TRUEPIXEL
@ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oBrowse:aCols ;
COLUMNS "lHide", "cHeader" ;
HEADERS "", "Header" ;
COLSIZES 40, 100 ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nStretchCol := 2
WITH OBJECT :aCols[ 1 ]
:bEditValue := { |x| If( x == nil, !oBrw:aRow:lHide, oBrw:aRow:lHide := !x ) }
:SetCheck( nil, .t. )
:nHeadBmpNo := 2
END
:CreateFromCode()
END
// @ 20,05 BTNBMP PROMPT "DBF" SIZE 80,30 FLAT PIXEL OF oDlg ACTION (cSaveFile:=msgget("Filename",,@cSaveFile), oBrowse:todbf( cSaveFile ,,,.t.))
@ 20,05 BTNBMP PROMPT "DBF" SIZE 80,30 FLAT PIXEL OF oDlg ACTION oBrowse:todbf(cSaveFile,,,.t.)
@ 20,90 BTNBMP PROMPT "ALL" SIZE 80,30 FLAT PIXEL OF oDlg ACTION (AEval( oBrowse:aCols, { |o| o:lHide := .f. } ),oDlg:End() )
@ 20,180 BTNBMP PROMPT "Close" SIZE 80,30 FLAT PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
oBrowse:Refresh()
return nil