__Bingo!
I think that this TDL tag may be very useful to other developers too, as it opens up the possibility of writing custom template code based on the presence of various standard fields (such as "Deleted").
Here are the ammends to the TDL related code - and yes, it is all copied and borrowed from what is already there
Otis - if you would like me to email you the files with these changes, let me know.
Thanks for your help.
Interpreter.cs:
Line 200:
case NonTerminalType.IfHasEntityFieldStart:
Line 369:
case NonTerminalType.IfHasEntityFieldStart:
HandleIfHasEntityFieldStart();
break;
_ Line 3117:_
private void HandleIfHasEntityFieldStart()
{
if(_currentEntity==null)
{
return;
}
NonTerminal current = (NonTerminal)_parseTree[_nonTerminalIndex];
bool negate = (((Token)((IToken)current.Tokens[2]).TokenID)==Token.Not);
int index=3;
if(negate)
{
index=4;
}
IToken fieldToken = (IToken)current.Tokens[index];
string fieldName = fieldToken.LiteralMatchedTokenText;
bool executeIfBody = ((_currentEntity.Fields[fieldName] != null)^negate);
if(executeIfBody)
{
_nonTerminalIndex++;
InnerIfHandler();
}
else
{
_nonTerminalIndex = current.CorrespondingEndNTIndex;
}
}
EnumConstants.cs
Line 90:
HasEntityField,
_ Line 245:_
IfHasEntityFieldStart,
** Parser.cs**
_ Line 940L_
case Token.HasEntityField:
tokensInStatement.Add(_tokenStream.Dequeue());
toReturn = new NonTerminal(NonTerminalType.IfHasEntityFieldStart);
break;
_ Line 1096:_
if(toReturn.Type==NonTerminalType.IfHasEntityFieldStart)
{
currentToken = (IToken)_tokenStream.Peek();
if(((Token)currentToken.LiteralMatchedTokenText.Length > 0))
{
tokensInStatement.Add(_tokenStream.Dequeue());
StripWhiteSpace();
}
}
_ Line 1840:_
_tokenDefinitions.Add(new TDLTokenDefinition((int)Token.HasEntityField, @"HasEntityField", RegexOptions.Compiled | RegexOptions.IgnoreCase));