dBASE Programming - Bizarre error message

This is Interesting: Free IT Magazines  
Home > Archive > dBASE Programming > March 2005 > Bizarre error message





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 Bizarre error message
Glenn

2005-03-28, 6:10 pm

Well, the message is not bizarre, but the way it happens is. Below is my
code for an NCAA pool program. The first loop through works fine, but
here is where it gets weird. I got a "Database engine error: operation
not applicable" at the line "r1 = val(substr(team1,1,1))" The funny part
is that all the data prints correctly anyway. I tried using a filter,
and got the same error message, until I added "go top" after the "set
filter to" statement. Do I have to cancel the LOCATE or something??

thanks,

Glenn Fausel

set alte to ncaa
set alte on
select c
use teams order team
select a
use slotsokla order name
sele b
use bracket1
sele a
ra = {"Chicago ","Albuquerque ","Austin ","Syracuse "}
do while not eof()
r1 = val(substr(team1,1,1)) <---- error message points to this line
store substr(team1,3,2) to t1
select b
locate for bracket = r1 and teamno = val(t1)
? eof(),team // eof() is always false, team prints correctly
sele c
seek b->team
? a->name,ra[r1],t1,c->teamname // this is correct also
sele b
select a
skip
enddo
?
set alte to
set alte off

Bruce Beacham

2005-03-28, 6:10 pm

Glenn wrote:
> Well, the message is not bizarre, but the way it happens is. Below is my
> code for an NCAA pool program. The first loop through works fine, but
> here is where it gets weird. I got a "Database engine error: operation
> not applicable" at the line "r1 = val(substr(team1,1,1))" The funny part


> r1 = val(substr(team1,1,1)) <---- error message points to this line


So what is team1? If it is a field, perhaps this row has a null in
that field.

Bruce Beacham
Glenn

2005-03-28, 6:10 pm

Bruce Beacham wrote:
> Glenn wrote:
>
>
>
>
>
> So what is team1? If it is a field, perhaps this row has a null in
> that field.
>
> Bruce Beacham


Nope ... afer I click ignore, the correct value is printed!

Glenn

Bruce Beacham

2005-03-28, 6:10 pm

>>> r1 = val(substr(team1,1,1)) <---- error message points to this line

[vbcol=seagreen]
> Nope ... afer I click ignore, the correct value is printed!


Well I suggest that you write a little program that merely uses that
table and loops through it with the command that is giving trouble. If
that works, then you must strip out your application code until you find
the position between the simple code and the full application that is
where it fails.


Bruce
Glenn

2005-03-28, 6:10 pm

Bruce Beacham wrote:

>
>
>
>
>
>
> Well I suggest that you write a little program that merely uses that
> table and loops through it with the command that is giving trouble. If
> that works, then you must strip out your application code until you find
> the position between the simple code and the full application that is
> where it fails.
>
>
> Bruce


If I add "locate for bracket = 1" after the first locate, there is no
error. As mentioned (I think) if I used a set filter statement to
achieve the same result, I had to issue a "go top" to get rid of the
error message.

I changed the locate/set filter to :
do while true
if bracket = r1 and teamno = val(t1)
exit
endif
skip
enddo

And this worked perfectly, so there has to be some problem with the
filter/locate option.

thanks,

Glenn

Gerald Lightsey

2005-03-28, 6:10 pm

On Thu, 17 Mar 2005 01:55:37 -0500, in the dbase.programming group,
Glenn said...
> The first loop through works fine, but
> here is where it gets weird. I got a "Database engine error: operation
> not applicable" at the line "r1 = val(substr(team1,1,1))"


I THINK you have encountered a bug that I recently submitted to dBI. In
my case the assignment of a decimal longitude value, (longitudes are
negative numbers in North America that I carry out to 13 decimal
places), brings up the same error you mention in the second iteration
through the loop. Assigning a decimal latitude value, (positive
number), in the same loop never fails.

The work-around for me was to assign the value to a custom property of
_app, (e.g. _app.lon = whatever).

Gerald
Glenn

2005-03-28, 6:10 pm

Bruce Beacham wrote:
>
>


I think I have found out what caused it, but not why.

I had:
t1 = substr(team1,3,2)
locate for (bracket = r1 and teamno = val(t1))

Changed to:
t1 = val(substr(team1,3,2))
locate for (bracket = r1 and teamno = t1)

The error went away. perhaps the mixing of types in the locate ????

Glenn

Todd Kreuter

2005-03-28, 6:10 pm

Glenn wrote:
>
>
> The error went away. perhaps the mixing of types in the locate ????


Hi Glenn,

Yes, that is a cause for that error message.

If remembering correctly, a length mismatch will also cause that error,
for example where CharField is a character length 5, the following will
result in that error:

applyLocate("CharField = 'this is too long'")

--
Todd Kreuter [dBVIPS]
Glenn

2005-03-28, 6:10 pm

Todd Kreuter wrote:
> Glenn wrote:
>
>
>
> Hi Glenn,
>
> Yes, that is a cause for that error message.
>
> If remembering correctly, a length mismatch will also cause that error,
> for example where CharField is a character length 5, the following will
> result in that error:
>
> applyLocate("CharField = 'this is too long'")
>


But the values are theoretically equal , are they not??

And the funniest thing is after you click ignore, the "?" statments show
that the locate was performed correctly!!

thanks

Glenn


Todd Kreuter [dBVIPS]

2005-03-28, 6:10 pm

"Glenn" <gfausel@aol.com> wrote in message
news:TOiaA4KLFHA.432@news-server...
>
> But the values are theoretically equal , are they not??
>
> And the funniest thing is after you click ignore, the "?" statments show
> that the locate was performed correctly!!


Well, not exactly equal.

Not a very useful error message, leaves you scratching you head wondering
what the problem is.

Todd Kreuter [dBVIPS]


Glenn

2005-03-28, 6:10 pm

In-Reply-To: <Zo9OuAPLFHA.432@news-server>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <bSiYncPLFHA.1528@news-server>
Newsgroups: dbase.programming
Lines: 16
Path: news-server
Xref: news-server dbase.programming:4469
NNTP-Posting-Host: 24-161-123-50.hvc.rr.com 24.161.123.50

Todd Kreuter [dBVIPS] wrote:
> "Glenn" <gfausel@aol.com> wrote in message
> news:TOiaA4KLFHA.432@news-server...
>
>
>
> Well, not exactly equal.
>


Could you explain?? Does dbase find a difference in the below
statements?? If so, my guess is that locate does not do well with
conversions. Perhaps it held on to it??

t1 = substr(team1,3,2)
locate for teamno = val(t1)

t1 = val(substr(team1,3,2))
locate for teamno = t1




Todd Kreuter [dBVIPS]

2005-03-28, 6:10 pm

"Glenn" <gfausel@aol.com> wrote in message
news:bSiYncPLFHA.1528@news-server...
>
> Could you explain?? Does dbase find a difference in the below
> statements?? If so, my guess is that locate does not do well with
> conversions. Perhaps it held on to it??
>
> t1 = substr(team1,3,2)
> locate for teamno = val(t1)
>
> t1 = val(substr(team1,3,2))
> locate for teamno = t1


Uh, I thought you were talking about the length issue I mentioned. Sorry.

Yes, I agree the resulting values are the same. Perhaps the expression is
passed to the bde as is before the VAL is performed???

Todd Kreuter [dBVIPS]


Glenn

2005-03-28, 6:10 pm

Todd Kreuter [dBVIPS] wrote:
> "Glenn" <gfausel@aol.com> wrote in message
> news:bSiYncPLFHA.1528@news-server...
>
>
>
> Uh, I thought you were talking about the length issue I mentioned. Sorry.
>
> Yes, I agree the resulting values are the same. Perhaps the expression is
> passed to the bde as is before the VAL is performed???
>
> Todd Kreuter [dBVIPS]
>
>

I think I left out something, or it got lost. It works the FIRST time
through the loop. The error message occurs anytime the value is
referenced AFTER the locate. Does that help??

Glenn

Todd Kreuter [dBVIPS]

2005-03-28, 6:10 pm

"Glenn" <gfausel@aol.com> wrote in message
news:9yl%23YARLFHA.1528@news-server...
>
> I think I left out something, or it got lost. It works the FIRST time
> through the loop. The error message occurs anytime the value is
> referenced AFTER the locate. Does that help??


Let me try a few things. I have a custom query for lookupRowsets that I get
this error in, have not spent the time preventing it in all cases.

Todd Kreuter [dBVIPS]


Todd Kreuter

2005-03-28, 6:10 pm

"Todd Kreuter [dBVIPS]" wrote:
>
>
> Let me try a few things. I have a custom query for lookupRowsets that I get
> this error in, have not spent the time preventing it in all cases.


I played around with this, and was able to duplicate the error for
things I knew would cause the error, but I was not able to duplicate
using your case. Maybe something else going on?

--
Todd Kreuter [dBVIPS]
Glenn

2005-03-28, 6:10 pm

Todd Kreuter wrote:
> "Todd Kreuter [dBVIPS]" wrote:
>
>
>
> I played around with this, and was able to duplicate the error for
> things I knew would cause the error, but I was not able to duplicate
> using your case. Maybe something else going on?
>


Hanky panky?? It is such a simple program, I don't see what else could
be happening. I will try to work up a demo tonight.

Thanks,

Glenn
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com