Defines the Report to run and various properties of the Report. This object can have the following properties:
The fully qualified report, label or letter name. For example:
inputProps.reportName = "[email protected]"
Can either be 'HTML' or 'PDF'. Specify if you want to see a PDF or HTML view of the report. HTML is recommended as it is substantially faster. If the user wants a PDF version of the report, they can click the 'PDF' button on the report toolbar.
Report filter. In the case of a report based on .dbf tables, filter can use Xbasic functions. The .filter can use arguments. For example:
country = :whatcountry
In the case of a report based on SQL data, it is recommended that you use the .sqlFilter property rather than the .filter property. If you do specify a .filter property for a SQL report, Alpha Anywhere will try to convert the .filter to a SQL filter. If the filter cannot be converted, the filter will be applied to the data after it has been loaded into a temporary .dbf table from the SQL database.
Order for the report.
In the case of a report based on SQL data, it is recommended that you use the .sqlOrder property rather than the .order property.
WHERE clause for a report based on SQL data. The sqlFilter can use arguments. For example:
country = :whatcountry
It is recommended that you use arguments in the filter rather than literal values. The argument values can be passed in in the .arguments property. (See below)
Order clause for a report based on SQL data.
Argument values must be supplied if the report filter uses arguments.
A CR-LF delimited string indicating each argument, its type and value. For example:
inputProps.arguments = <<%str% arg1|c|John arg2|n|23 arg3|d|12/18/1952 %str%
Alias of the component. Only needed if the report initial view is HTML.
The name of the DIV where the report will be shown.
Width of the report
Height of the report
Only needed for HTML reports. Specify the style name (e.g. iOs, etc) for the style of the HTML controls in the HTML Report Viewer.
(Optional). In the case where the initial view is PDF, a crlf delimited list of PDF options. See Report.SaveAs for available PDF options.
(Applies only when initialView is HTML)
By default, all of the buttons on the HTML Report View toolbar are turned on. These buttons are: Export as PDF, Export as Excel, Export as Word, Export as Text and Print HTML. You can optionally control whether a button is shown and you can control properties of each button (such as text, icon, style and bubble help).
The following properties are available to control the HTML Report View toolbar:
Set to .t. or .f. to control whether or not the PDF button appears on the Toolbar. If omitted, the default is .t.
Set to .t. or .f. to control whether or not the Excel button appears on the Toolbar. If omitted, the default is .t.
Set to .t. or .f. to control whether or not the Word button appears on the Toolbar. If omitted, the default is .t.
Set to .t. or .f. to control whether or not the Text button appears on the Toolbar. If omitted, the default is .t.
Set to .t. or .f. to control whether or not the Print HTML button appears on the Toolbar. If omitted, the default is .t.
<buttonType> must be: pdfButton, excelButton, wordButton, textButton, or printHTMLButton, depending on what type of button you are configuring. Allows you to specify the text label for the button. For example:
inputProps.buttons.pdfButton.text = "PDF"
Allows you to specify the button style. Options are: Text only, Image only, Text followed by Image, Image followed by text, Image above text, Text above image.
Allows you to specify the image for the button (if the image is configured to show an image). If using a built in image, use this syntax:
inputProps.buttons.pdfButton.imageName = "images/$$application.adobe.pdf.png.a5image"
Allows you to specify the bubble help for the button.
In this example, we show how you can create a UX component that allows a user to select a report and then click a button to print the report.
Assume that the UX component has the following controls:
A Dropdown called 'WhatReport' in which the user can select the report to print.
A control in which the user can enter the name of a state if the selected report is 'Customers'
A control in which the user can enter an invoice number if the selected report is 'Invoices'.
A button to print the selected report, filtered on the data in the appropriate control (state name or invoice number).
A static text control with this in it (this is where the report will be rendered):
In this example, the button will make an Ajax callback to a function (called say 'printReportXB'). Here is how the printReportXB function would be defined.
function printReportXB as c (e as p) delete p 'the p object we are going to define now is passed into 'a5_xb_runReport() to define the report we want to print dim p as p dim report as c 'the name of the report that the user selected is in the 'e.datasubmitted.whatreport variable report = e.datasubmitted.whatreport 'convert the short report name to a fully qualified report name if report = "customer" then p.reportName = "[email protected]" p.SQLFilter = "State = :whatstate " 'set the value of the arguments property to define any arguments used ' in the filter p.arguments = "whatState|c|" + e.datasubmitted.stateName else p.reportName = "[email protected]" p.sqlfilter = "invoice = :whatInvoice" 'set the value of the arguments property to define any arguments used ' in the filter p.arguments = "whatInvoice|n|" + e.datasubmitted.invoiceNumber end if 'set the initial report view to HTML. Can also set to PDF p.initialView = "html" 'since we are using HTML reporting we specify the alias of the host component p.componentAlias = e.tmpl.alias 'the id of the div where the report will be shown p.reportdiv = "rep1" 'the size of the report p.width = "12in" p.height = "4in" 'the style to use for the HTML Report Viewer. We want the style to match the 'style of the host component, so we pass in the style name used by the UX component p.styleName = e.tmpl.style_name 'Turn off the 'Export to Text' button on the Report Toolbar P.buttons.text = .f. 'Set the bubble help for the 'Print HTML' button to some text that uses 'language tags P.buttons.printHTMLButton.bubbleHelp = "<a5:r>Print</a5:r>" dim js as c 'Passing in tmpl and rtc is optional. however, if you don't then language tags 'in the buttons will not be evaluated. 'In this case, we used a language tag in the bubble help for one of the buttons js = a5_xb_runReport(p, e.tmpl, e.rtc) printReportXB = js end function
This example demonstrates running a Project report. To run a Workspace report, the syntax for the fully qualified report name is <report name>@<workspace name>.alb. EG, [email protected].
Workspace reports are only recommended for use in Desktop applications. Use Project reports in a Web or Mobile Alpha Anywhere application.
The PDF options parameters are defined as a CR-LF delimited list. A complete list of PDF options are listed in the Report.SaveAs article. The example below demonstrates how this is done:
dim pdfOptions as C pdfOptions =<<%str% DIM Concatenate as L DIM HasWatermark as L = .T. DIM MultilingualSupport as L = .T. DIM EmbedFonts as L DIM LinearizeForWeb as L DIM Colors2GrayScale as L DIM ConvertHyperlinks as L DIM WatermarkType as C = "Text" DIM WatermarkText as C = "D R A F T" DIM WatermarkFontName as C = "Times New Roman" DIM WatermarkFontSize as N = 172 DIM WatermarkRotation as N = 450 DIM WatermarkColorHex as C = "E8FED2" DIM WatermarkHorizPos as N = 120 DIM WatermarkVertPos as N = -120 DIM WatermarkOnTop as L DIM WatermarkPDF as C DIM Encrypt as L DIM OwnerPassword as C DIM UserPassword as C DIM CanPrint as L = .T. DIM CanModifyDocument as L = .T. DIM CanCopy as L = .T. DIM CanAddNotes as L = .T. DIM Use128BitKey as L = .T. DIM JpegQuality as C = "Low" %str%
You can also specify PDF options globally for the Alpha Anywhere project in the Web Project Properties. See PDF Printing Options for more information.
To learn more, watch the video below: