Special characters " (double quote) and \ (backslash) in templates and reports
Not version-specific
Tekla Structures
Environment
Not environment-specific
Question:
How to output special characters " (double quote) and \ (backslash) in templates and reports?
Answer:
- Double quote:
Template Editor uses the \ (backslash) as an escape character. To achieve the double quote, use \" (backslash + double quote). Similarly, you can use \n (backslash + n) to achieve a line break.
You can use, for example, a formula like this:
GetValue("NAME") + ":" + " \"" + GetValue("PROFILE") + "\""
To achieve a result like this:
BEAM: “HEA300”
Image
- Backslash:
Backslash is a bit more complicated. It works normally if it is not followed by " (double quote) or n. For example, you can write like this (backslash is followed by a space):
GetValue("NAME") + " \ " + GetValue("PROFILE")
To achieve a result like this:
BEAM \ HEA300
Image
But these would not work (backslash is followed by a quote):
GetValue("NAME ") + "\" + GetValue("PROFILE")
GetValue("NAME ") + "\\" + GetValue("PROFILE")
They would give you a result like this:
0
The EqlLib used by Tekla Structures removes the "\\" entirely, even though it would be logical that the end result would be \ (backslash). You can get the wanted result by using some function which takes a string as input and returns a string as output. For example, use mid function as follows:
mid("\ ", 0, 1)
This function returns a substring of a string. The first parameter is the input string. Note that there is a space after the backslash. Without the space this does not work. The second parameter is the starting offset. 0 means that we start from the first character. The third parameter is the length of the string to return. 1 means we return only one character.
So, you could use a formula like this:
GetValue("NAME") + mid("\ ", 0, 1) + GetValue("PROFILE")
To achieve a result like this:
BEAM\HEA300
Image