diff --git a/docs/8.0/ayanova/docs/ay-report-edit.md b/docs/8.0/ayanova/docs/ay-report-edit.md index 4e53afb2..5b260810 100644 --- a/docs/8.0/ayanova/docs/ay-report-edit.md +++ b/docs/8.0/ayanova/docs/ay-report-edit.md @@ -12,9 +12,9 @@ AyaNova report templates are based upon commonly used web technology and are HTM When a report is rendered the following steps take place behind the scenes: -- A request is made to the server providing a report template ID, selected business object id's or a DataList name and filter / sort options. -- The server retrieves the report template from the database, "re-hydrates" the business objects in memory, spins up a temporary "headless" web browser to do the rendering and feeds the data, report template and related objects to the browser to be processed by the Handlebars templating engine -- The resulting HTML document is rendered and converted to a .PDF format document, saved to a temporary location at the server and a download URL is sent back to the user's browser to download and open the .PDF document. +- A request is made to the server providing a report template ID, selected business object id's or a DataList name and filter / sort options. +- The server retrieves the report template from the database, "re-hydrates" the business objects in memory, spins up a temporary "headless" web browser to do the rendering and feeds the data, report template and related objects to the browser to be processed by the Handlebars templating engine +- The resulting HTML document is rendered and converted to a .PDF format document, saved to a temporary location at the server and a download URL is sent back to the user's browser to download and open the .PDF document. ## Mobile devices @@ -26,11 +26,11 @@ Note that _viewing_ reports is supported on all devices, only editing is unavail Report templates can be selected in AyaNova in the following places: -- AyaNova business object [edit forms](ay-start-edit-forms.md#report) -- AyaNova business object [data tables](ay-start-form-data-tables.md#report) -- [Report picker](ay-report.md) -- [Customer notification subscriptions](customer-notify-subscriptions.md) -- [Global settings Customer login self-service feature](adm-global-settings.md#work-orders) +- AyaNova business object [edit forms](ay-start-edit-forms.md#report) +- AyaNova business object [data tables](ay-start-form-data-tables.md#report) +- [Report picker](ay-report.md) +- [Customer notification subscriptions](customer-notify-subscriptions.md) +- [Global settings Customer login self-service feature](adm-global-settings.md#work-orders) ## Viewing @@ -44,11 +44,11 @@ All report templates available are displayed in the [Report templates data table These are the general properties of the report: -- `Name` the name of the report as it is displayed to users for selection; no two reports **for the same object type** can have the same name, however you can re-use a name for reports for different AyaNova Types -- `Who can select` this sets which User Roles are allowed to access the report. (_Security note_: no matter what is set here, the server will still not provide data to a report if that data is outside of the Roles of the current user so reporting is not a way circumvent AyaNova Role security) -- `Type` this controls the Type of AyaNova object for which this report will be offered as an option. This is useful for duplicating a report for use with a different type of object. For example if you have a report made for a Customer type object you can save a copy and change the Type to HeadOffice for use with a Head Office type object as the fields are almost identical so it will work for either object with only slight changes -- `Active` this controls report availability to users. Set to inactive to keep a report template in the databse but not make it available to users -- `Notes` about the template, only displayed in the designer UI, usually reference notes for the people involved in designing the reports +- `Name` the name of the report as it is displayed to users for selection; no two reports **for the same object type** can have the same name, however you can re-use a name for reports for different AyaNova Types +- `Who can select` this sets which User Roles are allowed to access the report. (_Security note_: no matter what is set here, the server will still not provide data to a report if that data is outside of the Roles of the current user so reporting is not a way circumvent AyaNova Role security) +- `Type` this controls the Type of AyaNova object for which this report will be offered as an option. This is useful for duplicating a report for use with a different type of object. For example if you have a report made for a Customer type object you can save a copy and change the Type to HeadOffice for use with a Head Office type object as the fields are almost identical so it will work for either object with only slight changes +- `Active` this controls report availability to users. Set to inactive to keep a report template in the databse but not make it available to users +- `Notes` about the template, only displayed in the designer UI, usually reference notes for the people involved in designing the reports ### PDF Options @@ -60,20 +60,20 @@ Report generation consists of two distinct and separate processes: Processing th #### PDF settings -- `Display header & footer` if checkmarked then the header and footer templates will be inserted into the output PDF document -- `Header template` HTML template for the PDF header. Use HTML markup with following classes used to inject special values into them - - `date` formatted print date - - `title` document title - - `url` document location - - `pageNumber` current page number - - `totalPages` total pages in the document -- `Footer template` HTML footer template, uses same properties as header template -- `Paper format` Standard paper size format, choose from list of supported formats -- `Landscape` Output in Landscape vs Portrait format -- `Botttom / Left / Top / Right Margin` Margin values formatted as a number and unit. Valid units are `px` - pixel, `cm` - centimeter, `in` - inch, `mm` - millimeters e.g. "11 mm" -- `Prefer CSS page size` Prioritizes any CSS @page size declared in the page over what is declared in width and height or format options. Defaults is false, which will scale the content to fit the paper size -- `Print background` print background graphics, default is false. _Must_ be checkmarked for CSS attributes such as alternating table rows to work. -- `Scale` scales the report rendering, must be a value between 0.1 and 2, the default is 1 +- `Display header & footer` if checkmarked then the header and footer templates will be inserted into the output PDF document +- `Header template` HTML template for the PDF header. Use HTML markup with following classes used to inject special values into them + - `date` formatted print date + - `title` document title + - `url` document location + - `pageNumber` current page number + - `totalPages` total pages in the document +- `Footer template` HTML footer template, uses same properties as header template +- `Paper format` Standard paper size format, choose from list of supported formats +- `Landscape` Output in Landscape vs Portrait format +- `Botttom / Left / Top / Right Margin` Margin values formatted as a number and unit. Valid units are `px` - pixel, `cm` - centimeter, `in` - inch, `mm` - millimeters e.g. "11 mm" +- `Prefer CSS page size` Prioritizes any CSS @page size declared in the page over what is declared in width and height or format options. Defaults is false, which will scale the content to fit the paper size +- `Print background` print background graphics, default is false. _Must_ be checkmarked for CSS attributes such as alternating table rows to work. +- `Scale` scales the report rendering, must be a value between 0.1 and 2, the default is 1 #### PDF header / footer template details @@ -118,8 +118,8 @@ Header ```html     Report rendered - on: PDFDate at: PDFTime    Report rendered + on: PDFDate at: PDFTime ``` @@ -127,10 +127,10 @@ Footer ```html Page  of     Page  of      ``` @@ -166,7 +166,7 @@ This is the default ayPrepareData method: ```javascript async function ayPrepareData(reportData) { - return reportData; + return reportData; } ``` @@ -249,6 +249,22 @@ The data provided to the report consists of the same fields visible in the user The report data provided comes directly from the Server and is not translated or localized into the current User's format as that is the responsiblity of the "Client" end, see the [Localization and Translation](#localization-and-translation) section for details. +#### Viz fields in report data + +You may notice many fields that end with the suffix "Viz" in the report data object. + +The "Viz" suffix is appended to the name of any fields that are generated by the server dynamically when data is being generated for reports. + +Typically, this is data that is not entered by the user or stored in the database for the specific object being reported. They are convenience fields to add more information for the user. + +Most often a viz field comes from other related objects that link to the object being reported or they are generated dynamically for example calculations that don't need to be stored in the database for efficiency. + +For example on a Work order report the field `CustomerViz` contains the Customer name for the Work order as the work order object itself does not store a Customer Name field as it may change and is not efficient to store directly in the work order object itself which only stores the internal ID number of that Customer's record. + +Another example of a calculated Viz field is the `LineTotalViz` field on work orders which is calculated dynamically at the moment the work order report data is gathered to send to the report generator. No line total is actually stored in the database as it can be calcluated 'on the fly' when needed. + +As the person editing a report template it can be helpful to know which fields are not stored directly in the object being reported if there is any question about where the value is coming from so we have adopted the standard of the "Viz" suffix. + #### Custom fields in report data In AyaNova an object can have up to [16 customizable fields](ay-customize.md#custom-fields) of extra data. @@ -335,9 +351,9 @@ ayServerMetaData: } ``` -- ayApiUrl - this is the URL of the server relative to the report generator and is useful for calling AyaNova API methods in your prepare data function to bring in sources of information from other areas of AyaNova that might not be directly available to your report -- HasXXLogo - these keys are set to true if a Logo has been uploaded for each size to AyaNova and are useful for controlling whether or not to show a logo on a report template as can be seen in many of our sample reports -- Company XXX fields - these fields represent your company information as entered in Global settings to provide a centralized source of information for all reports requiring company contact or address data +- ayApiUrl - this is the URL of the server relative to the report generator and is useful for calling AyaNova API methods in your prepare data function to bring in sources of information from other areas of AyaNova that might not be directly available to your report +- HasXXLogo - these keys are set to true if a Logo has been uploaded for each size to AyaNova and are useful for controlling whether or not to show a logo on a report template as can be seen in many of our sample reports +- Company XXX fields - these fields represent your company information as entered in Global settings to provide a centralized source of information for all reports requiring company contact or address data ### Accessing top level meta data from inside nested objects @@ -383,15 +399,15 @@ In AyaNova the `text` option of the `options` property is automatically set to t #### Gotchas -- Quotes: Be careful how you specify quotation marks around the options property, use full quotes for the inner field and property values and single quotes to enclose the whole string of JSON as in this example: +- Quotes: Be careful how you specify quotation marks around the options property, use full quotes for the inner field and property values and single quotes to enclose the whole string of JSON as in this example: `{{ ayBC ReportFieldName '{ "bcid": "code128"}' }}` -- Validity: certain bar codes (such as UPC) have a built in checksum validity check and will not render if the value is not valid. So, for example, you cannot use any random number as a UPC code, it _must_ contain valid checksum characters. Or for example an EAN-13 code _must_ contain 13 characters or it will not be valid either. +- Validity: certain bar codes (such as UPC) have a built in checksum validity check and will not render if the value is not valid. So, for example, you cannot use any random number as a UPC code, it _must_ contain valid checksum characters. Or for example an EAN-13 code _must_ contain 13 characters or it will not be valid either. If you are using bar codes only for internal purposes there are many forgiving options available such as Code39 barcodes (or Code 3 of 9) which do not require a check digit and can store up to 39 digits or QR Code or PDF417 '2d' bar codes which can store alphanumeric and ad-hoc data suitable for scanning with camera devices. -- Size: Some experimentation scaling and size options maybe be required to ensure bar codes are scannable depending on the rendering medium / equipment and scanner. +- Size: Some experimentation scaling and size options maybe be required to ensure bar codes are scannable depending on the rendering medium / equipment and scanner. #### Advanced usage @@ -490,8 +506,8 @@ For example, let's say you wanted to display the translation for Customer and Wo ```javascript async function ayPrepareData(reportData) { - await ayGetTranslations(["Customer", "WorkOrder"]); - return reportData; + await ayGetTranslations(["Customer", "WorkOrder"]); + return reportData; } ``` @@ -524,14 +540,14 @@ The following shows using the ayGroupBy function in the ayPrepareData to reforma ```javascript async function ayPrepareData(reportData) { - //send the raw report data to the groupByKey function which will return a new array grouped by the key name provided - reportData.ayReportData = ayGroupByKey( - reportData.ayReportData, - "CustomerViz" - ); + //send the raw report data to the groupByKey function which will return a new array grouped by the key name provided + reportData.ayReportData = ayGroupByKey( + reportData.ayReportData, + "CustomerViz" + ); - //return the data into the pipeline to send to the report template - return reportData; + //return the data into the pipeline to send to the report template + return reportData; } ``` @@ -597,27 +613,24 @@ The following is an example of accessing the API with both a GET and POST action ```javascript async function ayPrepareData(reportData) { - //Example API GET method - //to fetch data from API server - //using the "server-info" route + //Example API GET method + //to fetch data from API server + //using the "server-info" route - //Add the data to the main report data object - //so it's available to the template - reportData.myData = { - ServerInfo: await ayGetFromAPI("server-info") - }; + //Add the data to the main report data object + //so it's available to the template + reportData.myData = { + ServerInfo: await ayGetFromAPI("server-info") + }; - //Example API POST method to fetch data from api server - //using the "search" route + //Example API POST method to fetch data from api server + //using the "search" route - //construct the POST object - let searchPostData = { phrase: "fish" }; + //construct the POST object + let searchPostData = { phrase: "fish" }; - reportData.myData.SearchResults = await ayPostToAPI( - "search", - searchPostData - ); - return reportData; + reportData.myData.SearchResults = await ayPostToAPI("search", searchPostData); + return reportData; } ```