diff --git a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt index 39bf0ba5..5c6e9e95 100644 --- a/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt +++ b/server/AyaNova/resource/rpt/stock-report-templates/EXAMPLE API use and meta data.ayrt @@ -1 +1 @@ -{"Name":"EXAMPLE API use and meta data","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: Meta data and API usage

\n\t

See help documentation for details

\n\t\n\t
\n\t\t

ayServerMetaData

\n\t\t{{ ayJSON ayServerMetaData }}\n\t
\n\n\t
\n\t\t

ayClientMetaData

\n\t\t{{ ayJSON ayClientMetaData }}\n\t
\n\n\t
\n\t\t

ayReportMetaData

\n\t\t{{ ayJSON ayReportMetaData }}\n\t
\n\n\n\t
\n\t\t

myData

\n\t\t
(Fetched dynamically from API route enum-list/list/AyaType)
\n\t\t{{ ayJSON myData }}\n\t
\n\n\t
\n\t\t

ayReportData

\n\t\t{{#each ayReportData}}\n\t\t

{{ Name }}

\n\t\t
Notes: {{ Notes }}
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n //Example of using API GET method to fetch data from API server and make it available to the report template\n let route=`${reportData.ayServerMetaData.ayApiUrl}server-info`;\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(route, reportData.ayClientMetaData.Authorization)};\n\n //Example API POST method to fetch data from api server\n route=`${reportData.ayServerMetaData.ayApiUrl}search`;\n let searchPostData={phrase: \"Fresh\"};\n reportData.myData.SearchResults=await ayPostToAPI(route, searchPostData);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file +{"Name":"EXAMPLE API use and meta data","Active":true,"Notes":"","Roles":124927,"ObjectType":2,"Template":"\n\n\n\t

Example: Meta data and API usage

\n\t

See help documentation for details

\n\t\n\t
\n\t\t

ayServerMetaData

\n\t\t{{ ayJSON ayServerMetaData }}\n\t
\n\n\t
\n\t\t

ayClientMetaData

\n\t\t{{ ayJSON ayClientMetaData }}\n\t
\n\n\t
\n\t\t

ayReportMetaData

\n\t\t{{ ayJSON ayReportMetaData }}\n\t
\n\n\n\t
\n\t\t

myData

\n\t\t
(Fetched dynamically from API route enum-list/list/AyaType)
\n\t\t{{ ayJSON myData }}\n\t
\n\n\t
\n\t\t

ayReportData

\n\t\t{{#each ayReportData}}\n\t\t

{{ Name }}

\n\t\t
Notes: {{ Notes }}
\n\t\t{{/each}}\n\t
\n\n\n","Style":".example {\n color: blue;\n}","JsPrerender":"async function ayPrepareData(reportData) {\n //this function (if present) is called with the report data \n //before the report is rendered\n //modify data as required here and return it to change the data before the report renders \n\n //Example of using API GET method to fetch data from API server and make it available to the report template\n\n //Put the data into the main report data object so it's available to the template\n reportData.myData={ServerInfo:await ayGetFromAPI(\"server-info\")};\n\n //Example API POST method to fetch data from api server\n let searchPostData={phrase: \"Fresh\"};\n reportData.myData.SearchResults=await ayPostToAPI(\"search\", searchPostData);\n\n return reportData;\n}","JsHelpers":"//Register custom Handlebars helpers here to use in your report script\n//https://handlebarsjs.com/guide/#custom-helpers\nHandlebars.registerHelper('loud', function (aString) {\n return aString.toUpperCase()\n})","RenderType":0} \ No newline at end of file