From: Geoff Schaller on 3 Apr 2010 18:08 Good <g>. But please top post - it is too much effort to keep scrolling to the bottom of your post to find the latest comment. It is easier in use groups like these to read down to get latest to earliest posts. Cheers. Geoff "Woerdie" <woerdekom(a)gmail.com> wrote in message news:e8699304-c722-45fd-adb1-4f9229edb667(a)v20g2000yqv.googlegroups.com: > On 3 apr, 16:00, Woerdie <woerde...(a)gmail.com> wrote: > > > On 3 apr, 12:12, Woerdie <woerde...(a)gmail.com> wrote: > > > > > > > > > > On 3 apr, 01:50, "Geoff Schaller" <geo...(a)softxwareobjectives.com.au> > > > wrote: > > > > > > > Woerdie, > > > > > > Let's try and do this. The following code works for me: > > > > > > METHOD GenereerArtDbf2(cOutput, cSortGang, cFile) CLASS FacturenBrowse > > > > > > LOCAL nCurrentRecno AS WORD > > > > LOCAL oWin AS PrintProgress > > > > LOCAL n, y AS WORD > > > > LOCAL aDBStructure AS ARRAY > > > > LOCAL oOutput AS Facturen > > > > LOCAL oFacturen AS Facturen > > > > > > oFacturen:=Facturen{} > > > > IF !oFacturen:CreateOutputDBF() > > > > // report an error creating the DBF and take evasive action > > > > ENDIF > > > > oFacturen:Close() // but you don't have to if you need to use the > > > > data... > > > > > > oOutput:=Facturen{"OUTPUT"} //Openthe DBF > > > > // use oOutput > > > > oOutput:Close() > > > > > > RETURN NIL > > > > > > METHOD CreateOutputDBF() CLASS Facturen > > > > > > LOCAL aStruct AS ARRAY > > > > LOCAL lReturn AS LOGIC > > > > > > aStruct := SELF:DBFStructure > > > > > > // create a new DBF with the same structure but different name > > > > lReturn := > > > > DBCREATE("OUTPUT",aStruct,"BDBFCDX",TRUE,__UniqueAlias("OUTPUT")) > > > > > > DBCLOSEAREA() // flush to disk and close > > > > > > RETURN lReturn > > > > > > Now let's get one thing clear first: you have a DBServer class generated > > > > with the DBServer editor... yes? Good. Because of this, we can use that > > > > class for the input and output DBF in our code. We just pass the name of > > > > the DBF (NOT NOT PASS .DBF WITH THIS NAME) to the instantiation clause > > > > and it will pick up the correct DBF. I have not passed in the working > > > > folder path with the name but of course you can do this too. > > > > > > You can also create an output class to use like this: > > > > > > CLASS OutputFacturen INHERIT Facturen > > > > > > Now it will work. > > > > > > Cheers, > > > > > > Geoff > > > > > > Ok Geoff, thanks for your support, the create of the temp file works, > > > now i think the problem is somewhere else, error is on line: > > > > > // oOutput:=FACTUREN{"OUTPUT"} //Openthe DBF (your suggested code) > > > oOutput:=FACTUREN{oSystem:Workdir + "\FACTUREN.DBF"} //Openthe > > > DBF (my code) > > > > > Error message: > > > -------------- > > > Error Code: 21 [OPENERROR ] > > > Subsystem: DBFCDX > > > Error Subcode: 1101 (Opendatabase) > > > Function: INIT > > > Filename: ...... > > > CallStack: > > > MYOWNSERVER:INIT (Line:14) > > > FACTUREN:INIT (Line:65) > > > FACTURENBROWSE:GENEREERARTDBF2 (Line:17) > > > FACTURENBROWSE:PRINTFACTURENOPENSTAAND (Line:13) > > > PRINTSETTING:BUTTONOK (Line:49) > > > > > Error Object created: > > > -------------------- > > > SubSystem :DBFCDX > > > SubCode :1101 > > > GenCode :Openerror > > > OsCode :3 > > > ArgType :NIL > > > FuncPtr :0x00000000 > > > ArgNum :0 > > > FuncSym :INIT > > > Severity :2 > > > CanDefault :.F. > > > CanRetry :.T. > > > CanSubstitute :.F. > > > Operation : > > > Description : > > > FileName :D:\..........\TEMP\FACTUREN.DBF > > > Tries :1 > > > FileHandle :0 > > > SubCodeText :Opendatabase > > > Arg : > > > ArgTypeReq :NIL > > > MaxSize :0 > > > SubstituteType :NIL > > > CallFuncSym : > > > -------------------- > > > > > The MYOWNSERVER is: > > > CLASS MYOWNSERVER INHERIT DBSERVER > > > METHOD Close() CLASS MYOWNSERVER > > > > > self:Commit() > > > > > RETURN SUPER:Close() > > > METHOD init(oFileSpec, lShareMode, lReadOnlyMode, cDriver, lMerge, > > > lTemp) CLASS MYOWNSERVER > > > LOCAL cFile as STRING > > > LOCAL cPath as STRING > > > > > default lShareMode to true > > > default lReadOnlyMode to FALSE > > > default lMerge to FALSE > > > default lTemp to FALSE > > > > > cFile := oFileSpec:FileName > > > cPath := oFileSpec:Path > > > oFileSpec:Path := AllTrim(oSystem:PRGDatadir) + "\" + > > > AllTrim(oFileSpec:Path) > > > > > SUPER:init(oFileSpec, lShareMode, lReadOnlyMode, cDriver) > > > > > self:ConcurrencyControl := CCNONE > > > // SELF:ConcurrencyControl := CCOPTIMISTIC > > > > > RETURN self > > > METHOD RLOCK(nRecord) CLASS MYOWNSERVER > > > LOCAL lRetVal as LOGIC > > > LOCAL oWarningBox as Warningbox > > > > > IF !SUPER:RLOCK(nRecord) > > > > > // Laat een messagebox zien voor locking > > > oWarningBox := WarningBox{,"Locking probleem"+" "+ > > > AllTrim(self:ALIAS), "Deze gegevens zijn momenteel door iemand anders > > > in gebruik !" } > > > oWarningBox:Type := BOXICONEXCLAMATION + BUTTONOKAYCANCEL > > > oWarningBox:Show() > > > lRetVal := FALSE > > > ELSE > > > lRetVal := true > > > ENDIF > > > > > RETURN lRetVal > > > > > Oeps!, found out that the Init of MYOWNSERVER was: > > AllTrim(oSystem:PRGDatadir) + "\" + > AllTrim(oFileSpec:Path) here > > goes something wrong, investigating now... > > > Yes, that was it! Up and running now! > Thank you all for your contribution, I am now going to clean all the > clipper stuff.....
From: richard.townsendrose on 5 Apr 2010 08:53
hi even better, just take the time to delete all the stuff that you are replying to .. easier to read richard |