Topics

VFP Strangeness

Stein Goering
 

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Mike Yearwood
 

I don't know what caused that. I avoid & like the plague. It is the second last choice, just ahead of execscript. There are definitely place for both, but this example ain't it. In your case, I would have done if eval(m.lcPreFilter). If I have to use &, I always terminate with the 'optional' .


On Sun, May 3, 2020 at 2:22 PM Stein Goering <sgoering@...> wrote:

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Eric Selje
 

I've seen similar inconsistent behavior when it comes to inline SQL statements and macro expansion. 


On Sun, May 3, 2020 at 1:22 PM Stein Goering <sgoering@...> wrote:

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

TJ Reuter
 

Well I've run into situations where the debugger will point to the wrong line. Factor that into your research. 



Sent from my Verizon, Samsung Galaxy smartphone


-------- Original message --------
From: Stein Goering <sgoering@...>
Date: 5/3/20 1:22 PM (GMT-06:00)
To: MadFox@groups.io
Subject: [MadFox] VFP Strangeness

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Eric Selje
 

VFP Advanced fixes that, thankfully!


On Sun, May 3, 2020 at 9:50 PM TJ Reuter via groups.io <tjreuter=yahoo.com@groups.io> wrote:
Well I've run into situations where the debugger will point to the wrong line. Factor that into your research. 



Sent from my Verizon, Samsung Galaxy smartphone


-------- Original message --------
From: Stein Goering <sgoering@...>
Date: 5/3/20 1:22 PM (GMT-06:00)
Subject: [MadFox] VFP Strangeness

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Mike Yearwood
 

One thing that confuses the debugger: long sql commands constructed via "sql"+; "more sql"

Use TEXT...ENDTEXT

On Sun., May 3, 2020, 10:50 p.m. TJ Reuter via groups.io, <tjreuter=yahoo.com@groups.io> wrote:
Well I've run into situations where the debugger will point to the wrong line. Factor that into your research. 



Sent from my Verizon, Samsung Galaxy smartphone


-------- Original message --------
From: Stein Goering <sgoering@...>
Date: 5/3/20 1:22 PM (GMT-06:00)
Subject: [MadFox] VFP Strangeness

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Stein Goering
 

Thanks.  I was able to eliminate the errors (without using the interim assignment to lvExpand) by changing both those lines to use eval instead of &:

 

IF ( eval(m.lcPreFilter) )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

IF VARTYPE(eval(m.lcFld)<>[U] AND EMPTY(eval(m.lcFld))

So it appears that whatever is going on here, the issue is tied to the & macro substitution process.  I will take your advice and work on eliminating unnecessary & usage elsewhere in my code.

 

--stein

 

From: MadFox@groups.io On Behalf Of Mike Yearwood
Sent: Sunday, May 03, 2020 02:40 PM
To: MadFox@groups.io
Subject: Re: [MadFox] VFP Strangeness

 

I don't know what caused that. I avoid & like the plague. It is the second last choice, just ahead of execscript. There are definitely place for both, but this example ain't it. In your case, I would have done if eval(m.lcPreFilter). If I have to use &, I always terminate with the 'optional' .

 

On Sun, May 3, 2020 at 2:22 PM Stein Goering <sgoering@...> wrote:

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Stein Goering
 

I can't see that was an issue here, given that I was able to work around the errors by modifying the flagged lines.

 

From: MadFox@groups.io On Behalf Of TJ Reuter via groups.io
Sent: Sunday, May 03, 2020 09:51 PM
To: MadFox@groups.io
Subject: Re: [MadFox] VFP Strangeness

 

Well I've run into situations where the debugger will point to the wrong line. Factor that into your research. 

 

 

 

Sent from my Verizon, Samsung Galaxy smartphone

 

 

-------- Original message --------

From: Stein Goering <sgoering@...>

Date: 5/3/20 1:22 PM (GMT-06:00)

Subject: [MadFox] VFP Strangeness

 

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Eric Selje
 

One of the things that people have asked X# to replicate because it's so unique and powerful is the macro expansion capability. I'm leary of that though in its current incarnation. If it can do it some other way I'd be feel better about it.


On Mon, May 4, 2020 at 11:33 AM Stein Goering <sgoering@...> wrote:

Thanks.  I was able to eliminate the errors (without using the interim assignment to lvExpand) by changing both those lines to use eval instead of &:

 

IF ( eval(m.lcPreFilter) )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

IF VARTYPE(eval(m.lcFld)<>[U] AND EMPTY(eval(m.lcFld))

So it appears that whatever is going on here, the issue is tied to the & macro substitution process.  I will take your advice and work on eliminating unnecessary & usage elsewhere in my code.

 

--stein

 

From: MadFox@groups.io On Behalf Of Mike Yearwood
Sent: Sunday, May 03, 2020 02:40 PM
To: MadFox@groups.io
Subject: Re: [MadFox] VFP Strangeness

 

I don't know what caused that. I avoid & like the plague. It is the second last choice, just ahead of execscript. There are definitely place for both, but this example ain't it. In your case, I would have done if eval(m.lcPreFilter). If I have to use &, I always terminate with the 'optional' .

 

On Sun, May 3, 2020 at 2:22 PM Stein Goering <sgoering@...> wrote:

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Stein Goering
 

I actually thought about trying VFPA to see if it would better handle those macro expansion lines. 

 

Problem is if I started using it for development, it would mean installing new runtimes on our 100+ customer sites.

 

--stein

 

From: MadFox@groups.io On Behalf Of Eric Selje
Sent: Monday, May 04, 2020 07:40 AM
To: MadFox@groups.io
Subject: Re: [MadFox] VFP Strangeness

 

VFP Advanced fixes that, thankfully!

 

On Sun, May 3, 2020 at 9:50 PM TJ Reuter via groups.io <tjreuter=yahoo.com@groups.io> wrote:

Well I've run into situations where the debugger will point to the wrong line. Factor that into your research. 

 

 

 

Sent from my Verizon, Samsung Galaxy smartphone

 

 

-------- Original message --------

From: Stein Goering <sgoering@...>

Date: 5/3/20 1:22 PM (GMT-06:00)

Subject: [MadFox] VFP Strangeness

 

Doing a routine test of my app last night, I ran into this totally unexpected error:  Command contains unrecognized phrase/keyword.

 

The error handler pointed to this line:

  IF ( &lcPreFilter )  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

which I found baffling since that was added almost 3 years ago and has never been a problem.  After verifying that lcPreFilter evaluated to a valid logical expression, I changed the code to this:

  lvExpand = &lcPreFilter

  IF (lvExpand)  AND !(REQUEST.QueryString([Publish])=[ANYWAY])

 

That worked, but I then hit a similar error at another point in the program:

   IF VARTYPE(&lcFld)<>[U] AND EMPTY(&lcFld)

 

Again, I had to apply the same type of modification to code that has been working for years:

  lvExpand = &lcFld

  IF VARTYPE(lvExpand)<>[U] AND EMPTY(lvExpand) && &lcFld

 

So, WTF??  Why would VFP suddenly stop allowing macro expansion inside IF statements?

 

Has anyone else run into anything like this? 

 

 

--stein

 

Stein Goering, web developer

ACEware Systems, Inc

 

Mike Yearwood
 

I always look to write Name Expressions first, then eval(), then & and then Execscript.