KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to include comments in a 4D Transformation Tags Input Template
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: November 5, 2015

With the increased power of 4D Tranformation Tags will come increased size and complexity of input templates. With increased size and complexity comes the need to use comments to document what is being done at decision points in the template. Unfortunately there is not tag such as <--#4DCOMMENT --> tag for adding comments to an input template.

Using the example input template below, how could the text shown in parenthesis be turned into comments that will not be included in the output text?

<HTML>
<!--#4DEVAL myvar:=1-->
<BODY>
<!--#4DIF (myvar=1)--> (If condition)
  <p>MyVar equaled 1;</p> (Assign value to myVar)
<!--#4DENDIF--> (End if)
<!--#4DIF (myvar=2)--> (If condition)
  <p>MyVar equaled 2;</p> (Assign value to myVar)
<!--#4DENDIF--> (End if)
</BODY>
</HTML>


Easy, use the <--#4DEVAL --> tag.

<HTML>
<!--#4DEVAL myvar:=1-->
<BODY>
<!--#4DIF (myvar=1)--> <!--#4DEVAL //If condition-->
  <p>MyVar equaled 1;</p> <!--#4DEVAL //Assign value to myVar-->
<!--#4DENDIF--> <!--#4DEVAL //End if-->
<!--#4DIF (myvar=2)--> <!--#4DEVAL //If condition-->
  <p>MyVar equaled 2;</p> <!--#4DEVAL //Assign value to myVar-->
<!--#4DENDIF--> <!--#4DEVAL //End if-->
</BODY>
</HTML>


The resulting output from the call to PROCESS 4D TAGS is:

<HTML>

<BODY>

  <p>MyVar equaled 1;</p>

</BODY>
</HTML>

Note the result is the input template has documentation comments that are not included in the output.