Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11939

Re: OK, I'm sorry, but what am I doing wrong/missing?

From Stefano Costagli <stea@libero.it>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: OK, I'm sorry, but what am I doing wrong/missing?
Date 2018-09-18 09:34 +0200
Organization Aioe.org NNTP Server
Message-ID <pnq9pt$1b0a$1@gioia.aioe.org> (permalink)
References <54797b21-7920-4c52-9ff9-9f886bbdcd36@googlegroups.com>

Show all headers | View raw


Jeff,

CurDir( ) doesn't have the final backslash "\", so when you check the 
File(CurDir() + "client.dbf") it returns 
"c:\YourCurrentDirectoryclient.dbf".

Can I suggest to put in local var, eg.:
LOCAL cCurDir as STRING
LOCAL cDBFile as STRING

cCurDir := CurDir()
cDBFile := cCurDir + "\" + "client.dbf"

If File( cDBFile ) == .F.
...
Endif

less rendundacy, cleaner code, easy debugging

cheers
Stefano

On 18-Sep-18 8:48 AM, Jeff Rollo wrote:
> In my start() Method for my app I have the following code:
> 
> method Start() class App
> 	local oMainWindow as TopAppWindow
> 	LOCAL oServer
> 	local aDBF, aDBF2, aDBF3 as array
> 	local oFileSpec
> //	Local oDB as DBFileSpec
> 	local n := 0
> 	request dbfcdx
> 	SetPath(CurDir())
>    	self:Initialize()
>     Enable3dControls()
> 	oMainWindow := TopAppWindow{self}
> 	oMainWindow:Show(SHOWZOOMED)
> 	oMainWindow:Caption := "Business Manager v1.0"
> 	RddSetDefault("DBFCDX")
>     SetExclusive(FALSE)
>     SetDeleted(true)
>     oMainWindow:Icon := BMICON{}
> 	oMainWindow:IconSm := BMICON{}
>     SetEpoch(2000)
>     SetPath(CurDir())
>     If File(CurDir() + "client.dbf") == .F.
> //		oDB := DbFileSpec{}
> 		aDBF := {}
> 		AAdd(aDBF, {"ClCode", "C", 10, 0})
> 		AAdd(aDBF, {"ClName", "C", 100, 0})
> 		AAdd(aDBF, {"ClAdd1", "C", 100, 0})
> 		AAdd(aDBF, {"ClAdd2", "C", 100, 0})
> 		AAdd(aDBF, {"ClState", "C", 3, 0})
> 		AAdd(aDBF, {"ClSuburb", "C", 50, 0})
> 		AAdd(aDBF, {"ClPhone", "N", 10, 0})
> 		AAdd(aDBF, {"ClPcode", "N", 4, 0})
> 		AAdd(aDBF, {"ClABN", "C", 20, 0})
> 		AAdd(aDBF, {"ClEmail", "C", 100, 0})
> 		AAdd(aDBF, {"ClComments", "M", 10, 0})
> 		DBCREATE("Client.dbf", aDBF, "DBFCDX")
> //	   oDB:Create(CurDir(), aDBF, "DBFCDX")
> 	   oServer := CLIENT{self}
> 
> 	   oServer:CreateIndex("Client", "CLCode",,.T.)
> 	   oServer:CreateOrder("CLName", "Client", "ClName")
> 	   oServer:CreateOrder("ClState", "Client", "ClState")
> 	   oServer:CreateOrder("CLCodeName", "Client", (AllTrim(CLIENT->ClCode) + " " + AllTrim(CLIENT->ClName)))
> 	   oServer:CreateOrder("CLPcode", "Client", "ClPCode")
> 	   oServer:Close()
>    	ENDIF
>   
> 
> Try as I might, the files are not being created. There's no runtime or compiler errors to give me any clues, I've been all over Google, the printed Manual, the online manual and this Group, and still cannot work out where I'm going wrong.
> 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-17 23:48 -0700
  Re: OK, I'm sorry, but what am I doing wrong/missing? Stefano Costagli <stea@libero.it> - 2018-09-18 09:34 +0200
    Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-18 00:58 -0700
      Re: OK, I'm sorry, but what am I doing wrong/missing? Robert van der Hulst <rjvanderhulst@gmail.com> - 2018-09-18 01:54 -0700
        Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-18 02:07 -0700
          Re: OK, I'm sorry, but what am I doing wrong/missing? Stefano Costagli <stea@libero.it> - 2018-09-18 12:07 +0200
          Re: OK, I'm sorry, but what am I doing wrong/missing? Robert van der Hulst <rjvanderhulst@gmail.com> - 2018-09-18 03:10 -0700
            Re: OK, I'm sorry, but what am I doing wrong/missing? Franz Rachbauer <office@rachbauer.org> - 2018-09-18 12:34 +0200
              Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-18 04:23 -0700
                Re: OK, I'm sorry, but what am I doing wrong/missing? Mathias <mathias.hakansson@consultec.se> - 2018-09-18 04:57 -0700
              Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-18 04:27 -0700
                Re: OK, I'm sorry, but what am I doing wrong/missing? Franz Rachbauer <office@rachbauer.org> - 2018-09-18 14:00 +0200
                Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-18 05:05 -0700
                Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-18 05:06 -0700
                Re: OK, I'm sorry, but what am I doing wrong/missing? Leo_Bond <l.bond@bk.ru> - 2018-09-18 05:37 -0700
                Re: OK, I'm sorry, but what am I doing wrong/missing? "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-09-18 16:18 +0200
                Re: OK, I'm sorry, but what am I doing wrong/missing? dlzc <dlzc1@cox.net> - 2018-09-18 06:48 -0700
  Re: OK, I'm sorry, but what am I doing wrong/missing? Mathias <mathias.hakansson@consultec.se> - 2018-09-19 04:43 -0700
    Re: OK, I'm sorry, but what am I doing wrong/missing? Mathias <mathias.hakansson@consultec.se> - 2018-09-19 05:03 -0700
    Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-19 05:20 -0700
      Re: OK, I'm sorry, but what am I doing wrong/missing? "Jamal" <noooospam@example.com> - 2018-09-19 13:36 -0400
        Re: OK, I'm sorry, but what am I doing wrong/missing? Jeff Rollo <jrollo64@gmail.com> - 2018-09-19 15:42 -0700
      Re: OK, I'm sorry, but what am I doing wrong/missing? Mathias <mathias.hakansson@consultec.se> - 2018-09-20 02:46 -0700
  Re: OK, I'm sorry, but what am I doing wrong/missing? Sherlock <sherlock@sherlock.com.au> - 2018-09-19 05:24 -0700

csiph-web