Skip to content

Commit

Permalink
Merge pull request #437 from ProcessMaker/bugfix/FOUR-18927
Browse files Browse the repository at this point in the history
FOUR-18927: Issue with the PMQL
  • Loading branch information
ryancooley authored Sep 29, 2024
2 parents 7568afd + b8128bd commit 0632151
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/FormSelectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,18 @@ export default {
isMultiSelectDisabled() {
return this.options.allowMultiSelect === false;
},
hasNestedProperty(obj, path) {
return path.split(".").reduce((acc, part) => acc && acc[part], obj);
},
renderPmql(pmql) {
if (typeof pmql !== "undefined" && pmql !== "" && pmql !== null) {
const data = this.makeProxyData();
return Mustache.render(pmql, data);
const preprocessedTemplate = pmql.replace(/{{\s*([\w.]+)\s*}}/g, (match, key) => {
return this.hasNestedProperty(data, key) ? match : `[[[${key}]]]`;
});
const output = Mustache.render(preprocessedTemplate, data);
const last = Mustache.render(output.replace("[[[", "{{").replace("]]]", "}}"), { data });
return last;
}
return "";
},
Expand Down

0 comments on commit 0632151

Please sign in to comment.