From a4136f25a92bed200799cbb16ca832867049d827 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 10 Mar 2022 19:58:45 +0000 Subject: [PATCH] case 4137 --- docs/8.0/ayanova/docs/ay-report-edit.md | 22 +++++++++++++++++++++- server/AyaNova/resource/rpt/ay-report.js | 9 +++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/8.0/ayanova/docs/ay-report-edit.md b/docs/8.0/ayanova/docs/ay-report-edit.md index ea61161d..d81df403 100644 --- a/docs/8.0/ayanova/docs/ay-report-edit.md +++ b/docs/8.0/ayanova/docs/ay-report-edit.md @@ -197,7 +197,7 @@ The report data provided comes directly from the Server and is not translated or #### Custom fields in report data -In AyaNova an object can have up to 16 customizable fields of extra data. In the *SAMPLE DATA* area of the report editor interface you can see the custom field data, for example: +In AyaNova an object can have up to 16 customizable fields of extra data. In the _SAMPLE DATA_ area of the report editor interface you can see the custom field data, for example: ```json "CustomFields": { @@ -341,6 +341,26 @@ Format value as all capitals: `{{ ayCaps ReportFieldName }}` +### ayConcat + +Concatenates the given arguments into a string. + +Arguments to the helper are either field names or static strings separated by a single space between each one. + +The result of the helper is each argument's value appended to the end of the previous one. This means there are no spaces between them unless you add spacing arguments as in the first example below. + +Used as the only helper on it's own: + +`{{ ayConcat field1 ',' field2 '->' 'blue' someotherfield ' ' 'morestring' }}` + +Would result in "contentsoffield1,contentsoffield2->bluecontentsofsomeotherfield morestring" + +As an argument to _another_ helper: + +`{{ ayBC (ayConcat 'workorder:' Serial ',' 'customer:' customerViz) '{ "bcid": "qrcode","includetext":true, "scale":3}' }}` + +This example from a work order report would create a QR Code that contains text from multiple fields, e.g. "workorder:483,customer:XYZ accounting". + ### ayCurrency Formats a raw currency decimal value into a currency value formatted for the locale of the Client or server / report default diff --git a/server/AyaNova/resource/rpt/ay-report.js b/server/AyaNova/resource/rpt/ay-report.js index 56f0ee9d..8cd287b4 100644 --- a/server/AyaNova/resource/rpt/ay-report.js +++ b/server/AyaNova/resource/rpt/ay-report.js @@ -133,6 +133,15 @@ function ayRegisterHelpers() { } //eof +/////////////////////////////////////////// +// Concat helper using +// https://stackoverflow.com/a/52571635/8939 +// +Handlebars.registerHelper('ayConcat', function() { + arguments = [...arguments].slice(0, -1); + return arguments.join(''); +}); + //##################################### LOCALIZATION & TRANSLATION ################################################### ///////////////////////////////////////////