Difference between revisions of "Variable Syntax"
From SmartWiki
Mark Bridger (talk | contribs) (→Overview) |
Mark Bridger (talk | contribs) (→Overview) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
=Overview= | =Overview= | ||
| − | The Variable Processor in SmartSimple dynamically replaces variable references | + | The Variable Processor in SmartSimple dynamically replaces variable references e.g. |
| + | |||
| + | <pre>{{firstname}}</pre> | ||
| + | |||
| + | with actual values (e.g., John). These variable references can be used throughout the system, allowing the same data to appear consistently in multiple locations. | ||
| + | Previously, variable syntax used the @ symbol as part of the reference. However, this approach is not compatible with the rich text editor. To address this, we are introducing a new syntax that uses | ||
| + | |||
| + | <pre>{{ }}</pre> | ||
| + | |||
| + | instead of the @ symbol. | ||
| − | |||
Below is a table outlining the changes. Note: | Below is a table outlining the changes. Note: | ||
| Line 9: | Line 17: | ||
* During this transition, both syntaxes can be used while the new format undergoes testing and refinement. | * During this transition, both syntaxes can be used while the new format undergoes testing and refinement. | ||
| + | {| class="wikitable" | ||
| + | |- | ||
| + | !|Old Syntax | ||
| + | !|New Syntax | ||
| + | |- | ||
| + | || | ||
| + | <pre>@fieldname@</pre> | ||
| + | || | ||
| + | <pre>{{fieldname}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@fieldname.value@</pre> | ||
| + | || | ||
| + | <pre>{{fieldname.value}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>test</pre> | ||
| + | || | ||
| + | <pre>{{ssEncrypt(test)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>test</pre> | ||
| + | || | ||
| + | <pre>{{ssTranslate(test)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>test</pre> | ||
| + | || | ||
| + | <pre>{{ssEscape(test)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre><!--@sslogic(condition)--></pre> | ||
| + | || | ||
| + | <pre>{{ss_if(condition)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre><!--@else if(condition)--></pre> | ||
| + | || | ||
| + | <pre>{{ss_elseif(condition)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre><!--@else--></pre> | ||
| + | || | ||
| + | <pre>{{ss_else}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre><!--end--></pre> | ||
| + | || | ||
| + | <pre>{{ss_endif}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre><!--@sscalculation(expression)--></pre> | ||
| + | || | ||
| + | <pre>{{ss_eval(expression)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@ssGet(...)@</pre> | ||
| + | || | ||
| + | <pre>{{ssGet(…)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@system.fieldname@</pre> | ||
| + | || | ||
| + | <pre>{{system.fieldname}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@xml.fieldname.nodename@</pre> | ||
| + | || | ||
| + | <pre>{{xml.fieldname.nodename}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@parent.fieldname@</pre> | ||
| + | || | ||
| + | <pre>{{parent.fieldname}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@ReportProperty(...)@</pre> | ||
| + | || | ||
| + | <pre>{{ReportProperty(…)}}</pre> | ||
| + | |- | ||
| + | || | ||
| + | <pre>@parent.[# … #]@</pre> | ||
| + | || | ||
| + | <pre>{{parent.[# … #]}}</pre> | ||
| + | |} | ||
[[Category:Variables]] | [[Category:Variables]] | ||
Latest revision as of 17:11, 15 December 2025
Overview
The Variable Processor in SmartSimple dynamically replaces variable references e.g.
{{firstname}}
with actual values (e.g., John). These variable references can be used throughout the system, allowing the same data to appear consistently in multiple locations. Previously, variable syntax used the @ symbol as part of the reference. However, this approach is not compatible with the rich text editor. To address this, we are introducing a new syntax that uses
{{ }}
instead of the @ symbol.
Below is a table outlining the changes. Note:
- The new syntax is currently in development and must be enabled by the SmartSimple team for your system.
- During this transition, both syntaxes can be used while the new format undergoes testing and refinement.
| Old Syntax | New Syntax |
|---|---|
@fieldname@ |
{{fieldname}}
|
@fieldname.value@ |
{{fieldname.value}}
|
test |
{{ssEncrypt(test)}}
|
test |
{{ssTranslate(test)}}
|
test |
{{ssEscape(test)}}
|
<!--@sslogic(condition)--> |
{{ss_if(condition)}}
|
<!--@else if(condition)--> |
{{ss_elseif(condition)}}
|
<!--@else--> |
{{ss_else}}
|
<!--end--> |
{{ss_endif}}
|
<!--@sscalculation(expression)--> |
{{ss_eval(expression)}}
|
@ssGet(...)@ |
{{ssGet(…)}}
|
@system.fieldname@ |
{{system.fieldname}}
|
@xml.fieldname.nodename@ |
{{xml.fieldname.nodename}}
|
@parent.fieldname@ |
{{parent.fieldname}}
|
@ReportProperty(...)@ |
{{ReportProperty(…)}}
|
@parent.[# … #]@ |
{{parent.[# … #]}}
|