KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D Transformation Tags and 4D Constants
PRODUCT: 4D | VERSION: 14 R5 | PLATFORM: Mac & Win
Published On: November 25, 2015

When writing input templates special consideraton needs to be given when 4D constants are being used with the 4DEVAL tag.

Using the following example line from an input template written by a developer using an english language version of 4D...

<!--4DEVAL WRITE PICTURE FILE:C680($thepath+"Images"+Folder separator+$picname;[CLIENTS]Logo)-->

As long as this input template is processed using an english language version of 4D there will be no problem. But one needs to remember that input templates are text, not 4D code, and are interpruted on the on the fly.

One needs to be aware that "constants" are a text representatives or hard values, numbers or text. When an 4D method is saved, it is the real value and not the user friendly representation of the constant that is saved. So the question is how to integrate constants into input templates.

In a different language version of 4D the human readable version of the constant "Folder separator" may be "Séparateur dossier", "Ordner-Trenn", "separador de carpetas", or "フォルダの区切り" and because it is not recognized as a 4D constant will not be processed properly.

The association of the real value of constants and the user friendly representation is established when 4D launches. So that value has to be captured into a variable before that input template is processed with the varible embedded into the template. For example...

Folder separator at startup is assigned its value based on the OS. On windows its value is "/" while on Mac it is ":". So it could be handled as follows:

C_TEXT(<>FolderSeparator_T)
<>FolderSeparator_T:=Folder separator

Now the input template is changed as follows:

<!--4DEVAL WRITE PICTURE FILE:C680($thepath+"Images"+<>FolderSeparator_T+$picname;[CLIENTS]Logo)-->

Now if the input template is processed in a different language version of 4D it will work.