-
Notifications
You must be signed in to change notification settings - Fork 8
/
expansiontokens.htm
250 lines (249 loc) · 15.4 KB
/
expansiontokens.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!DOCTYPE HTML>
<html id="hs-topic-p">
<!-- saved from url=(0025)http://www.helpsmith.com/ -->
<head>
<title>Expansion Tokens</title>
<meta charset="windows-1252" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="HelpSmith 9.8 (Build 23.1026)" />
<link type="text/css" rel="stylesheet" href="../css/topics/style.css" />
<script type="text/javascript" src="../js/jquery-3.7.1.min.js"></script>
<style type="text/css" media="screen">
html {
height: 100%;
}
body {
margin: 0;
}
</style>
<script type="text/javascript" src="../js/settings.js?d3532453"></script>
<script type="text/javascript" src="../js/core.min.js?adb9c364"></script>
<script type="text/javascript" src="../js/topic.min.js?adb9c364"></script>
<script type="text/javascript">
var topicContext = 250;
</script>
<!-- Web Help Topic -->
<!-- HTML Help (CHM) Topic -->
</head>
<body class="nsa-wrapper">
<div id="nsa-box" class="nsa-content0">
<h1 class="hd0"><span class="ts0">Expansion Tokens</span></h1>
</div>
<div id="sa-box">
<div id="content-box" class="sa-content0">
<p> </p>
<p class="ps1"><span class="ts2">Expansion tokens are special symbols that can be used within a </span><a href="templatefiles.htm" class="hs8">template file</a><span class="ts2">, either to cause CodeGen to take some special action, or to refer to some information from a metadata source. Most expansion tokens cause CodeGen to output some piece of information to the output stream for the current template. In some cases the information that is output is fairly generic, for example the current date or time, but in many cases the information is derived from an external source such as a repository structure. CodeGen recognizes and processes several different categories of expansion tokens. Some of these tokens can be used at any time, whilst others can only be used within a certain context in a template file.</span></p>
<p class="ps1"><span class="ts2">Expansion tokens consist of a single tag (a special keyword delimited by less-than (<) and greater-than (>) characters) and most cause some value to be written to the output stream for the current template. An example of an expansion token of this type is the </span><a href="genericexpansiontokens.htm#%3CDATE%3E" class="hs9"><DATE></a><span class="ts2"> token that was discussed earlier.</span></p>
<p class="ps1"><span class="ts2">When CodeGen processes a template file in order to create an output file it is constantly searching for known expansion tokens, and when a token is encountered some action is taken based on the name and nature of the token.</span></p>
<div class="block0">
<table class="tbl1">
<tr class="row0">
<td class="cell0">
<p class="ps1"><a href="genericexpansiontokens.htm" class="hs8">Generic Tokens</a></p>
</td>
<td class="cell1">
<p class="ps1"><span class="ts2">Generic tokens are tokens which can be used in any template file.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="structureexpansiontokens.htm" class="hs8">Structure Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Structure tokens are tokens which are replaced with some piece of information obtained from, or some piece of code derived from a Repository structure. Structure tokens can only be used when processing a template in conjunction with a Repository structure. Processing a template file which uses one or more structure tokens without referencing a Repository structure will cause an error during code generation.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="fieldloops.htm" class="hs8">Field Loop Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Field loop tokens are tokens which are replaced with some piece of information obtained from, or some piece of code derived from a Repository field definition. Field loop tokens are only valid inside a field loop. This again implies that a Repository structure is required in order to process a template containing field loop tokens. Processing a template file which uses one or more field loop tokens without referencing a Repository structure will cause an error during code generation.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="fieldloopexpressiontokens.htm" class="hs8">Field Loop Expression Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Field loop expression tokens are tokens which allow you to control whether a certain piece of code is emitted to the output file or not, based on the evaluation of some expression based on the attributes of field. For example, you could use a conditional expression to only emit a piece of code if a field is marked as a required field, or if the data type of a field is decimal.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="keyloops.htm" class="hs8">Key Loop Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Key loop tokens are tokens which are replaced with some piece of information obtained from, or some piece of code derived from a Repository key definition. Key loop tokens are only valid inside a key loop.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="keysegmentloops.htm" class="hs8">Key Segment Loop Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Key segment loop tokens are tokens which are replaced with some piece of information obtained from, or some piece of code derived from a Repository key segment definition. Key segment loop tokens are only valid inside a key segment loop.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="relationloops.htm" class="hs8">Relation Loop Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Relation loop tokens are tokens which are replaced with some piece of information obtained from, or some piece of code derived from a Repository relation definition. Relation loop tokens are only valid inside a relation loop.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="windowexpansiontokens.htm" class="hs8">Window Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Window tokens are tokens which are replaced with some piece of information about a window definition.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="buttonloops.htm" class="hs8">Button Loop Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Button loop tokens are tokens which are replaced with some piece of information relating to a button definition. Button loop tokens are only valid within a button loop.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="userdefinedexpansiontokens.htm" class="hs8">User-Defined Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">User defined tokens are non-standard tokens that can be defined by you in order to have CodeGen generate code other than what it natively supports. There are several ways of defining user defined tokens. User defined tokens do not inherently require the use of a Repository structure during code generation, unless the code generated by the user defined tokens includes other structure or field loop tokens.</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell2">
<p class="ps1"><a href="looputilityexpansiontokens.htm" class="hs8">Loop Utility Tokens</a></p>
</td>
<td class="cell3">
<p class="ps1"><span class="ts2">Loop utility tokens insert information based on the processing status of the current template file loop construct, and can be used in any of the loop constructs.</span></p>
</td>
</tr>
</table>
</div>
<h2 class="hd1"><span class="ts1">Expansion Token Variations</span></h2>
<p class="ps1"><span class="ts2">All expansion tokens are valid in upper case (as shown in this documentation) and many are valid only in upper case. Generally, when the name of an expansion token appears in uppercase, then the associated replacement text that is written to the output stream will also be in upper case. But there are some exceptions to this rule, typically when the token refers to a piece of metadata which resolves to a piece of “free text” such as descriptions that were entered as free text.</span></p>
<p class="ps1"><span class="ts2">Some tokens are documented to have "alternate forms". For example, the </span><a href="structureexpansiontokens.htm#STRUCTURE_NAME" class="hs9"><STRUCTURE_NAME></a><span class="ts2"> token, which normally outputs the name of the repository structure in all uppercase characters, has five alternate forms, as follows:</span></p>
<div class="block0">
<table class="tbl1">
<tr class="row1">
<td class="cell4">
<h3 class="hd1"><span class="ts9">Token Type</span></h3>
</td>
<td class="cell5">
<h3 class="hd1"><span class="ts9">Token</span></h3>
</td>
<td class="cell6">
<h3 class="hd1"><span class="ts9">Description</span></h3>
</td>
<td class="cell7">
<h3 class="hd1"><span class="ts9">Example</span></h3>
</td>
</tr>
<tr class="row0">
<td class="cell8">
<p class="ps1"><span class="ts2">Upper-case</span></p>
</td>
<td class="cell9">
<p class="ps1"><span class="ts3"><STRUCTURE_NAME></span></p>
</td>
<td class="cell10">
<p class="ps1"><span class="ts2">This token causes the name of the current structure to be sent to the output file, in all uppercase, and with underscores preserved.</span></p>
</td>
<td class="cell11">
<p class="ps1"><span class="ts2">CUSTOMER_CONTACT</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell8">
<p class="ps1"><span class="ts2">Lower-case</span></p>
</td>
<td class="cell12">
<p class="ps1"><span class="ts3"><structure_name></span></p>
</td>
<td class="cell10">
<p class="ps1"><span class="ts2">This token causes the name of the current structure to be sent to the output file, in all lowercase, and with underscores preserved.</span></p>
</td>
<td class="cell11">
<p class="ps1"><span class="ts2">customer_contact</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell8">
<p class="ps1"><span class="ts2">Mixed-case</span></p>
</td>
<td class="cell12">
<p class="ps1"><span class="ts3"><Structure_Name></span></p>
</td>
<td class="cell10">
<p class="ps1"><span class="ts2">This token causes the name of the current structure to be sent to the output file, in lowercase, but with the first letter of each word upper-cased, and with underscores preserved.</span></p>
</td>
<td class="cell11">
<p class="ps1"><span class="ts2">Customer_Contact</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell8">
<p class="ps1"><span class="ts2">"xf"-case</span></p>
</td>
<td class="cell12">
<p class="ps1"><span class="ts3"><Structure_name></span></p>
</td>
<td class="cell10">
<p class="ps1"><span class="ts2">This token causes the name of the current structure to be sent to the output file, in lowercase, but with the first letter of the first word upper-cased, and with underscores preserved. This format is compatible with the way in which GENCS and GENJAVA expose Synergy data to xfNetLink clients.</span></p>
</td>
<td class="cell11">
<p class="ps1"><span class="ts2">Customer_contact</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell8">
<p class="ps1"><span class="ts2">Pascal-case</span></p>
</td>
<td class="cell12">
<p class="ps1"><span class="ts3"><StructureName></span></p>
</td>
<td class="cell10">
<p class="ps1"><span class="ts2">This token causes the name of the current structure to be sent to the output file in “pascal-case”. The string is lower-cased and then any character following anything except 0-9, A-Z and a-z is upper-cased. Then anything other than 0-9, A-Z and a-z is removed, and finally the first character is upper-cased.</span></p>
</td>
<td class="cell11">
<p class="ps1"><span class="ts2">CustomerContact</span></p>
</td>
</tr>
<tr class="row0">
<td class="cell8">
<p class="ps1"><span class="ts2">Camel-case</span></p>
</td>
<td class="cell12">
<p class="ps1"><span class="ts3"><structureName></span></p>
</td>
<td class="cell10">
<p class="ps1"><span class="ts2">This token causes the name of the current structure to be sent to the output file in “camel-case”. The string is lower-cased and then any character following anything except 0-9, A-Z and a-z is upper-cased. Finally anything other than 0-9, A-Z and a-z is removed.</span></p>
</td>
<td class="cell11">
<p class="ps1"><span class="ts2">customerContact</span></p>
</td>
</tr>
</table>
</div>
<p class="ps1"><span class="ts2">If an expansion token is not documented to have alternate forms then that token is ONLY valid when typed in upper case. CodeGen will not act upon tokens that it does not recognize. Any token that CodeGen does not explicitly recognize will simply be ignored, and written to the output stream. If you see tokens in your output file, check your spelling and case sensitivity. The only exception to this rule is if you are using “user defined tokens” which are documented later.</span></p>
<p class="ps1"><span class="ts2"> </span></p>
<p class="ps1"><span class="ts2"> </span></p>
<p class="ps1"><span class="ts2"> </span></p>
<p><span class="ts2"> </span></p>
<p><span class="ts2"> </span></p>
<div class="hr-wrapper">
<hr class="hline1" />
</div>
<p class="ps8"><span class="ts10">Copyright © 2021 Synergex International, Inc.</span></p>
</div>
</div>
</body>
</html>