-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 7.0.X, 7.1.X, Master
-
Fix Version/s: 7.1.10 DXP FP10, 7.1.10.2 SP2, 7.1.3 CE GA4, 7.1.X, Master
-
Component/s: Dynamic Data Mapping, Dynamic Data Mapping > Template Editor
-
Branch Version/s:7.1.x
-
Backported to Branch:Committed
-
Fix Priority:3
-
Git Pull Request:
Reproduction steps
- Start the latest master
- Create a new site
- Create a new structure "struct1" with a Date field embedded into another one, e.g.: add a Text field named "T1" and inside that a Date field named "D1"
- Click "Manage Templates" on struct1 and "Add" to open the template editor
- Click "D1" on the left side, and a code like this will be added to the editor:
<#assign T1.D1_Data = getterUtil.getString(T1.D1.getData())> <#if validator.isNotNull(T1.D1_Data)> <#assign T1.D1_DateObj = dateUtil.parseDate("yyyy-MM-dd", T1.D1_Data, locale)> ${dateUtil.getDate(T1.D1_DateObj, "dd MMM yyyy - HH:mm:ss", locale)} </#if>
- Save the template
- Go to Web Contents, create a new "struct1" web content, fill both fields
- Preview the web content
Expected: the date value of the web content article is shown correctly
actual: an error is shown instead of the web content:
An error occurred while processing the template. Syntax error in template "20115#20151#36778" in line 1, column 12: Encountered ".", but was expecting one of: "=" "+=" "-=" "*=" "/=" "%=" "++" "--" "in" ">" 1<#assign T1.D1_Data = getterUtil.getString(T1.D1.getData())> 2 3<#if validator.isNotNull(T1.D1_Data)> 4 <#assign T1.D1_DateObj = dateUtil.parseDate("yyyy-MM-dd", T1.D1_Data, locale)> 5 6 ${dateUtil.getDate(T1.D1_DateObj, "dd MMM yyyy - HH:mm:ss", locale)} 7</#if>
Reproduced on:
7.1.x : Commit: ee3cc2d128e09e039854f643acc4d3963069dfc0
Master: Commit: 304c1ae6a8bd439f952ae662954dfef1c58848b0
Note
The problem seems to be that the generated FTL code is wrong: "T1.D1_Data" is an invalid variable name in FTL. However, the variable names can contain special characters, when they are escaped with "\": "T1\.D1_Data"