Home > Archive > Programming with dBASE > November 2005 > variable undefined error makes no sense to me









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author variable undefined error makes no sense to me
Dan Barbaria

2005-11-11, 11:23 am

Hi all,

At the top of my program I define ORIG_DIR as follows:

#define ORIG_DIR
" D:\Data\Background_R
outines\PDFsforCat\P
DFsForCatOriginals"

The following lines are 45, 46 and 47. Line 45 (the msgbox) displays the
value of the variable as expected however the next line throws a "Variable
undefined: ORIG_DIR" error. It makes no sense to me can someone explain.

msgbox(ORIG_DIR)
nextline =[new File().delete("]+ORIG_DIR+"\"+cJobNumber+[.pdf")]
&nextline

Thanks
Dan Barbaria


Ivar B. Jessen

2005-11-11, 1:23 pm

On Fri, 11 Nov 2005 10:19:56 -0600, "Dan Barbaria" <daniel.barbaria at
ops.org> wrote:

>At the top of my program I define ORIG_DIR as follows:
>
>#define ORIG_DIR
>" D:\Data\Background_R
outines\PDFsforCat\P
DFsForCatOriginals"
>
>The following lines are 45, 46 and 47. Line 45 (the msgbox) displays the
>value of the variable as expected however the next line throws a "Variable
>undefined: ORIG_DIR" error. It makes no sense to me can someone explain.
>
>msgbox(ORIG_DIR)
> nextline =[new File().delete("]+ORIG_DIR+"\"+cJobNumber+[.pdf")]
> &nextline


Does this work?

I shortened the path to illustrate that it is not wrapped in quotes


#define ORIG_DIR D:\Data\PDFsForCatOr
iginals
msgbox([ORIG_DIR])
nextline = [ORIG_DIR] + "\" + cJobNumber + ".pdf"
delete file &nextline


Ivar B. Jessen
Dan Barbaria

2005-11-11, 8:23 pm


> Does this work?
>
> I shortened the path to illustrate that it is not wrapped in quotes
>
>
> #define ORIG_DIR D:\Data\PDFsForCatOr
iginals
> msgbox([ORIG_DIR])
> nextline = [ORIG_DIR] + "\" + cJobNumber + ".pdf"
> delete file &nextline


Ivar,

Yes it works.

I guess I don't understand it though. I would expect the
msgbox([ORIG_DIR]) to display ORIG_DIR and msgbox(ORIG_DIR) to display
D:\Data\PDFsForCatOr
iginals

I have to work with this more to get a better handle on it.

Thanks,

Dan Barbaria


Ivar B. Jessen

2005-11-11, 8:23 pm

On Fri, 11 Nov 2005 13:49:14 -0600, "Dan Barbaria" <daniel.barbaria at
ops.org> wrote:

>
>
>Ivar,
>
>Yes it works.
>
> I guess I don't understand it though. I would expect the
>msgbox([ORIG_DIR]) to display ORIG_DIR and msgbox(ORIG_DIR) to display
> D:\Data\PDFsForCatOr
iginals
>
>I have to work with this more to get a better handle on it.
>
>Thanks,


You are welcome.


Ivar B. Jessen
Charles Crume

2005-11-11, 8:23 pm


"Dan Barbaria" <daniel.barbaria at ops.org> wrote in message
news:6adDayt5FHA.1232@news-server...
> Hi all,
>
> At the top of my program I define ORIG_DIR as follows:
>
> #define ORIG_DIR
> " D:\Data\Background_R
outines\PDFsforCat\P
DFsForCatOriginals"
>
> The following lines are 45, 46 and 47. Line 45 (the msgbox) displays the
> value of the variable as expected however the next line throws a "Variable
> undefined: ORIG_DIR" error. It makes no sense to me can someone explain.
>
> msgbox(ORIG_DIR)
> nextline =[new File().delete("]+ORIG_DIR+"\"+cJobNumber+[.pdf")]
> &nextline
>
> Thanks
> Dan Barbaria


I created a file named "123.pdf" in my "c:\temp" folder, then tried:

ORIG_DIR="c:\temp"; cJobNumber="123"; nextline =[new
File().delete("]+ORIG_DIR+"\"+cJobNumber+[.pdf")]; ?nextline; &nextline

It works A-OK for me (Plus 2.21, XP Home).

Maybe you should check the value in "cJobNumber" by printing the value of
"nextline" to see what's causing the problem.

Charles...




Charles Crume

2005-11-14, 3:23 am


"Charles Crume" < NOccsSPAM@charlescru
mesoftware.com> wrote in message
news:8LZeO3x5FHA.892@news-server...
>
> "Dan Barbaria" <daniel.barbaria at ops.org> wrote in message
> news:6adDayt5FHA.1232@news-server...
>
> I created a file named "123.pdf" in my "c:\temp" folder, then tried:
>
> ORIG_DIR="c:\temp"; cJobNumber="123"; nextline =[new
> File().delete("]+ORIG_DIR+"\"+cJobNumber+[.pdf")]; ?nextline; &nextline
>
> It works A-OK for me (Plus 2.21, XP Home).
>
> Maybe you should check the value in "cJobNumber" by printing the value of
> "nextline" to see what's causing the problem.
>
> Charles...
>


Dan;

Did you ever figure this out?

I did and am wondering if we came to the same solution.

Charles...


Dan Barbaria

2005-11-22, 11:23 am


> Dan;
>
> Did you ever figure this out?
>
> I did and am wondering if we came to the same solution.
>
> Charles...

Charles,

I have not been able to get back to this project. I had to leave town for 9
days unexpectedly. Today is my first day back to work and I've got a bunch
to catch-up on.

I will look at this again soon and let you know what I find.

Thanks
Dan


Dan Barbaria

2005-11-22, 8:23 pm


>
> Dan;
>
> Did you ever figure this out?
>
> I did and am wondering if we came to the same solution.
>
> Charles...

Charles,

Ivar's solution works and that is what I'm going with. What you came up
with works as well. The difference is the way we establish the value of
ORIG_DIR.

I'm using a #define directive as shown below.
#define ORIG_DIR D:\Data\Background_R
outines\PDFsforCat\P
DFsForCatOriginals

You are assigning a variable:
ORIG_DIR="c:\temp"

I like to use #define directives because I place them all at the top of the
program. They seem to work very much like a Public Variable because they
seem to always be in scope. This makes them easy to change if I have to.
For example, with this project the path for ORIG_DIR is different on my test
web server then the path on my live server. After testing, I just replace
the #define directives at the top and the program works fine.

I still don't have a good handle on the correct syntax when using these.
Ivar got me where I need to be even though I'm still a bit confused.

Dan



Marko Mihorko [dBVIPS]

2005-11-23, 11:23 am

Hello Dan!

"Dan Barbaria" je napisal v sporočilo...

....[color=darkred]
> I still don't have a good handle on the correct syntax when using these.


The following worked for me:

#define ORIG_DIR "D:\Whatever"
nextline ='new File().delete("'+ORIG_DIR+"\"+cJobNumber+[.pdf")]
&nextline

Marko Mihorko [dBVIPS]












Dan Barbaria

2005-11-23, 1:23 pm


"Marko Mihorko [dBVIPS]" <xyz@xyz.com> wrote in message
news:Jg5z9YE8FHA.1520@news-server...
> Hello Dan!
>
> "Dan Barbaria" je napisal v sporočilo...
>
> ....
>
> The following worked for me:
>
> #define ORIG_DIR "D:\Whatever"
> nextline ='new File().delete("'+ORIG_DIR+"\"+cJobNumber+[.pdf")]
> &nextline
>
> Marko Mihorko [dBVIPS]


Hi Marko!

It's nice to "see" you here again.

I don't see much difference between my syntax and yours with the exception
that you used single quotes and I used square brackets as delimiters at the
first part of the statement.

In any event, Ivar's suggestion worked and that is what I'm going with.

Thanks

Dan



Charles Crume

2005-11-23, 8:23 pm


"Dan Barbaria" <daniel.barbaria at ops.org> wrote in message
news:D1W7h5F8FHA.1228@news-server...
>
> "Marko Mihorko [dBVIPS]" <xyz@xyz.com> wrote in message
> news:Jg5z9YE8FHA.1520@news-server...
>
> Hi Marko!
>
> It's nice to "see" you here again.
>
> I don't see much difference between my syntax and yours with the exception
> that you used single quotes and I used square brackets as delimiters at
> the first part of the statement.


Changing the [ to ' is what I came up with also -- after looking at your
problem for a while longer. According to the OLH single quotes, double
quotes, and brackets can all be used to quote strings -- but it appears that
the [ are not working properly in your case.

Charles...


Marko Mihorko [dBVIPS]

2005-11-27, 3:24 am

Hello Dan!

"Dan Barbaria" je napisal v sporočilo...

> It's nice to "see" you here again.


Thank you. I manage to fly by at times (but usually only on weekends :-(

> I don't see much difference between my syntax and yours with the exception
> that you used single quotes and I used square brackets as delimiters at the
> first part of the statement.


Yes, there is not much difference, indeed, except perhaps that your syntax
doesn't work and mine does. ;-)

So, I suggest that you report this tiny behavioural difference with its proper
name (namely, as a bug ;-) in the bug-reports newsgroups.

> Thanks


You are welcome.

Marko Mihorko [dBVIPS]


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com