Preprocessor IF THEN ELSE

Dougan778

New Member
Is anybody having issues using the operators described in the help file with something like
&IF {&FIELD} = 4 &THEN
&ENDIF

?

Or is '4' not "constant enough" for the preprocessor?

What I'd really like to do is this:

&IF NOT {&INCLUDE-DEFINED} &THEN
&SCOPED-DEFINE INCLUDE-DEFINED YES
...include body here
&ENDIF


but that doesn't work either.
 

Casper

ProgressTalk.com Moderator
Staff member
if you take this code and put it in an include c:\temp\t.i

Code:
&IF {&test} = 4 &THEN
  MESSAGE 4
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
&ELSE 
MESSAGE 'not 4'
    VIEW-AS ALERT-BOX INFO BUTTONS OK.
&endif
and use it like this:

Code:
{ c:\temp\t.i &test=4}
then it does exactly what you want.

Casper.
 

suny

ProgressTalk.com Sponsor
The right syntax:

&if defined(MYINC) = 0 &then
&global-define MYINC
...
include body
...
&endif

Use global-define. When your include take in an include, then scope-define doesn't work in all file.
 

D.Cook

New Member
Something we've always done is just quote the values, like this:

Code:
&IF "{&FIELD}" = "4" &THEN
&ENDIF
 
Top