1 line
8.5 KiB
Plaintext
1 line
8.5 KiB
Plaintext
{"Name":"💡109x EXAMPLE PO API use and meta data","Active":true,"Notes":"","Roles":124927,"AType":26,"IncludeWoItemDescendants":false,"Template":"<html>\n\n<body>\n\t<h1>Example: Meta data and API usage</h1>\n\t<h3>See help documentation for further details</h3>\n\t\n\t<div>\n\t\t<h2>ayServerMetaData - from the database</h2>\n\t\t<p>If specify only the ayServerMetaData between mustashes, displays all this info: </p>\n\t\t<p>{{ ayJSON ayServerMetaData }}</p>\n\t\t<ul>\n\t\t<li>whereas if specify ayServerMetaData.ayApiUrl then displays only: {{ ayJSON ayServerMetaData.ayApiUrl }}</li>\n\t\t<li>whereas if specify ayServerMetaData.HasSmallLogo then displays only: {{ ayJSON ayServerMetaData.HasSmallLogo }}</li>\n\t\t{{#if ayServerMetaData.hasSmallLogo}}<li class=\"greenfont\">{{ayServerMetaData.hasSmallLogo}}</li>{{else}}<li class=\"bluefont\">Nothing displays because property is incorrectly identified with wrong case</li>{{/if}}\n\t\t<li>whereas if specify ayServerMetaData.HasMediumLogo then displays only: {{ ayJSON ayServerMetaData.HasMediumLogo }}</li>\n\t\t{{#if ayServerMetaData.HasMediumLogo}}<li class=\"greenfont\">if ayServerMetaData.HasMediumLogo HAS data will show in green font {{ayServerMetaData.HasMediumLogo}}</li>{{else}}<li class=\"bluefont\">if ayServerMetaData.HasMediumLogo does NOT have data will show this in flue font</li>{{/if}}\n\t\t<li>whereas if specify ayServerMetaData.HasLargeLogo then displays only: {{ ayJSON ayServerMetaData.HasLargeLogo }}</li>\n\t\t{{#if ayServerMetaData.HasLargeLogo}}<li class=\"greenfont\">if each statement = if ayServerMetaData.HasLargeLogo HAS a value, then displays that value here --> {{ayServerMetaData.HasLargeLogo}}</li>{{else}}<li class=\"bluefont\">If each statement - if ayServerMetaData.HasLargeLogo DOES NOT have a value, then displays this text instead</li>{{/if}}\n\t\t</ul>\n\t</div>\n\t<hr>\n\n\t<div>\n\t\t<h2>ayClientMetaData - from the web browser you have used for this session</h2>\n\t\t<p class=\"greenfont\">If only specify ayClientMetaData between the mustaches then displays all this info (keys and values): </p>\n\t\t<p>{{ ayJSON ayClientMetaData }}</p>\n\t\t<ul>\n\t\t<li>whereas if specify ayClientMetaData.UserName then displays the value: {{ ayJSON ayClientMetaData.UserName }}</li>\n\t\t<li>whereas if specify ayClientMetaData.Authorization then displays the value: {{ ayJSON ayClientMetaData.Authorization }}</li>\n\t\t<li>whereas if specify ayClientMetaData.TimeZoneName then displays the value: {{ ayJSON ayClientMetaData.TimeZoneName }}</li>\n\t\t<li>whereas if specify ayClientMetaData.LanguageName then displays the value: {{ ayJSON ayClientMetaData.LanguageName }}</li>\n\t\t<li>whereas if specify ayClientMetaData.Hour12 then displays the value: {{ ayJSON ayClientMetaData.Hour12 }}</li>\n\t\t<li>whereas if specify ayClientMetaData.CurrencyName then displays the value: {{ ayJSON ayClientMetaData.CurrencyName }}</li>\n\t\t<li>whereas if specify ayClientMetaData.DefaultLocale then displays the value: {{ ayJSON ayClientMetaData.DefaultLocale }}</li>\t\t\n\t\t</ul>\n\t</div>\n\t<hr>\n\n\t<div>\t\t\n\t\t<h2>ayReportMetaData - from this report template</h2>\n\t\t<p class=\"greenfont\">If only specify ayReportMetaData between the mustashes then displays all this info (keys and values including array values): </p>\n\t\t<p>{{ ayJSON ayReportMetaData }}</p>\n\t\t<ul>\n\t\t<li>if specify ayReportMetaData.Id then displays the value: {{ ayJSON ayReportMetaData.Id }}</li>\n\t\t<li>if specify ayReportMetaData.Name then displays the value: {{ ayJSON ayReportMetaData.Name }}</li>\n\t\t<li>if specify ayReportMetaData.ObjectType then displays the value: {{ ayJSON ayReportMetaData.ObjectType }}</li>\n\t\t<li>if specify ayReportMetaData.CustomFieldsDefinition then displays the value: {{ ayJSON ayReportMetaData.CustomFieldsDefinition }}</li>\n\t\t<li>if specify ayReportMetaData.DataListKey then displays the value: {{ ayJSON ayReportMetaData.DataListKey }}</li>\n\t\t<li>if specify ayReportMetaData.SelectedRowIds then displays the value: {{ ayJSON ayReportMetaData.SelectedRowIds }}</li>\t\t\n\t\t</ul>\n\t</div>\n\t<hr>\n\n\t<div>\n\t\t<h2>myData - Fetched dynamically from API route <strong>enum-list/list/AyaType</strong> using report template's Prepare</h2>\n\t\t<h2>In this case, myData includes ServerInfo AND SearchResults</h2>\n\t\t<p>specifically, Prepare searches for the text \"purple\" in any object in the database and returns....\n\t\t<p class=\"greenfont\">If only specify myData (the name given via Prepare in this report template) between mustashes then displays all this info:</p>\n\t\t<p> {{ ayJSON myData }}</p>\n\t\t<ul>\n\t\t\t<li>if specify myData.ServerInfo then displays the value: {{ ayJSON myData.ServerInfo }}</li>\n\t\t\t<ul>\n\t\t\t\t<li>to specfiy individual property such as myData.ServerInfo.data.serverVersion: {{ ayJSON myData.ServerInfo.data.serverVersion }}</li>\n\t\t\t\t<li>to specfiy individual property such as myData.ServerInfo.data.serverTimeZone: {{ ayJSON myData.ServerInfo.data.serverTimeZone }}</li>\n\t\t\t\t<li>to specfiy individual property such as myData.ServerInfo.data.license: {{ ayJSON myData.ServerInfo.data.license }}</li>\n\t\t\t\t<ul>\n\t\t\t\t\t<li>to specfiy individual property such as myData.ServerInfo.data.license.license.licensedTo: {{ ayJSON myData.ServerInfo.data.license.license.licensedTo }}</li>\n\t\t\t\t\t<li>to specfiy individual property such as myData.ServerInfo.data.license.license.licenseExpiration: {{ ayJSON myData.ServerInfo.data.license.license.licenseExpiration }}</li>\n\t\t\t\t\t<li>to specfiy individual property such as myData.ServerInfo.data.license.license.features: {{ ayJSON myData.ServerInfo.data.license.license.features }}</li>\n\t\t\t\t\t<li>to specfiy the third of the array of the individual property of myData.ServerInfo.data.license.license.features.[2]: {{ ayJSON myData.ServerInfo.data.license.license.features.[2] }}</li>\n\t\t\t\t\t<li></li>\t\t\t\t\t\n\t\t\t\t</ul>\t\t\t\t\n\t\t\t\t<li></li>\n\t\t\t</ul>\n\t\t\t<li>if specify myData.SearchResults between the mustashes then displays the value: {{ ayJSON myData.SearchResults }}\t</li>\t\n\t\t\t<ul>\n\t\t\t\t<li>to specfiy individual property such as myData.SearchResults.data.searchResults: {{ ayJSON myData.SearchResults.data.searchResults }}</li>\n\t\t\t\t<ul>\n\t\t\t\t\t<li>to display the third array in the searchresults myData.SearchResults.data.searchResults.[2]]: {{ ayJSON myData.SearchResults.data.searchResults.[2] }}</li>\n\t\t\t\t\t<li></li>\t\t\t\t\t\n\t\t\t\t</ul>\n\t\t\t\t<ul title=\"to display the value for name for each in the array needs an #each statement on the ayJSON myData.SearchResults.data.searchResults\">\n\t\t\t\t{{#each myData.SearchResults.data.searchResults}}\n\t\t\t\t\t<li>{{ayJSON name }}</li>\n\t\t\t\t{{/each}}\n\t\t\t\t</ul>\n\t\t\t\t\n\t\t\t</ul>\n\t\t</ul>\n\t</div>\n\t<hr>\n\t\n\t<div>\n\t\t<h4>ayReportData - to display the PO Number value and the PO Notes value for each PO in the list:</h4>\n\t\t{{#each ayReportData}}\n\t\t<h2>PO#: {{ Serial }}</h2>\n\t\t<div>Notes: <span class=\"bluefont\">{{ Notes }}</span></div>\n\t\t{{/each}}\n\t</div>\n</body>\n\n</html>","Style":".bluefont {\n color: blue;\n}\n\n.greenfont {\n color: green;\n}\n\nul[title]::before {\n content: attr(title);\n /* then add some nice styling as needed, eg: */\n font-weight: bold;\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: \"Purple\"};\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,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":"15mm","MarginOptionsLeft":"10mm","MarginOptionsRight":"10mm","MarginOptionsTop":"15mm","PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.00000} |