Cannot get `OMIT` working according to the documentation

I am trying to figure out how OMIT works - better said I want to eventually create a template in which one can define a value - but I want to have a fallback value, or better said a default value for the equate if it’s not set - but I can’t get the following piece of code to work - it throws a Unknown Identifier unless I remove the OMIT (comment it out is enough`

OMIT('MyEquateValue', MyEquateValue <> 0)
MyEquateValue EQUATE('TEST')
MyEquate EQUATE(MyEquateValue)

The above was inside my .inc file which I include - but it does act the same inside the Global Data section - my program is currently Clarion 8 (Legacy)

The thing I don’t understand is that it should only be omitted when it has a value other than 0 - it’s 0 by default if not defined according to the documentation - but clearly it does have a value, otherwise it wouldn’t be omitted right?

Got it fixed - apparently it works a little different than I thought- following works:

OMIT('*My Equate*', MyEquate <> 0)
MyEquate EQUATE('TEST')
! *My Equate*

Read the help carefully. If your Expression is just an Equate Label without an operator (no = <> ) e.g.

   OMIT('xxx', _IncludeMyCode_)
   xxx

Of _IncludeMyCode_help says

If the Expression contains an EQUATE that has not yet been defined, then the referenced EQUATE is assumed to be zero (0). COMPILE and OMIT are opposites.

It actually was the way I wrote it - I used the EQUATE as terminator and that didn’t work

Here I am again - for some reason it’s still not working - I’ve got the following:

Inside After Global Includes

MyEquate EQUATE('I did something')
INCLUDE('MyInclude.inc'),ONCE

Inside MyInClude.inc

OMIT('*My Equate*', MyEquate <> 0)
MyEquate EQUATE('TEST')
! *My Equate*

But further up in the code I MESSAGE the value and it still shows TEST instead of the overriden value - so I thought, let’s do it as suggested:

Inside After Global Includes

MyEquateOverride EQUATE(1)
MyEquate EQUATE('I did something')
INCLUDE('MyInclude.inc'),ONCE

Inside MyInClude.inc

OMIT('*My Equate*', MyEquateOverride)
MyEquate EQUATE('TEST')
! *My Equate*

But it still shows TEST and not I did something - any idea @CarlBarnes
Perhaps it doesn’t work across Program and .inc?

MyEquate is a string = ‘Test’ but you’re comparing it to number = 0

I get that - but even the example with only numbers doesn’t work MyEquateOverride

The help states that the expression is a value of zero or one so don’t use a string, just change…
MyEquate EQUATE('TEST')
to
MyEquate EQUATE(1)

I’ll repeat myself - the second example, with MyEquateOverride doesn’t work either - I repeated it below

Inside After Global Includes

MyEquateOverride EQUATE(1)
MyEquate EQUATE('I did something')
INCLUDE('MyInclude.inc'),ONCE

Inside MyInClude.inc

OMIT('*My Equate*', MyEquateOverride)
MyEquate EQUATE('TEST')
! *My Equate*

Possibly you didn’t understand, but you’re essentially writing
OMIT('*My Equate*', 'I did something' )

Now, when interpreting the string 'I did something' as a NUMBER, it becomes 0
as the first character is a capital ‘i’ which which is neither a digit nor white space

So I wouldn’t expect it to OMIT the code

I’ll repeat myself again as I understand a STRING is not a NUMBER - the second example, with MyEquateOverride doesn’t work either - I repeated it below

Inside After Global Includes

MyEquateOverride EQUATE(1)
MyEquate EQUATE('I did something')
INCLUDE('MyInclude.inc'),ONCE

Inside MyInClude.inc

OMIT('*My Equate*', MyEquateOverride)
MyEquate EQUATE('TEST')
! *My Equate*

That does not make sense that it shows TEST.

The way it looks to me is you have Omit( ,1) so the EQUATE('TEST') should be omitted i.e. not compiled. If it did compile it would cause a compile error because MyEquate is defined twice.

Your snippets look ok. The best way to resolve this is to zip up a complete example project and attach it so others can build exactly what you have.