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`
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?
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.
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
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
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.