Report

Q:
I have an issue with report which can only display detail record. I would like to know how i can generate report with header section containing information from parent table information (eg Order) and detail section containing information from child table (eg order details).
A:
Report Sections are single table (though can be a virtual table) reports. The report is generated by sending parameters to the report.rsp Lianja server page script in the Library.

You could use report.rsp as a template for building your master detail report – copy it into your open App (using the ‘Additional command’ and have a look at the code. You can then call your modified code from a WebView Section.

As a quick example, I added these lines to my copy of report.rsp (in my App and called mdreport.rsp) after the ‘m_selected = select()’ line:

Code:
use orders
list html off for orderid = 10248
use

(You should check if the table is used() and save and restore the recno() accordingly or use SAVE DATASESSION / RESTORE_DATASESSION)

My WebView URL is:

mdreport.rsp?database=southwind&table=order_detail s&fields=*&filter=orderid=10248&heading=Order Details

Which gives me a basic master-detail report:

Using report.rsp as a template, you could customise the display to your requirements and add in additional parameters for the master table information and relationship to the details table.


Report Sections are based on the ‘report.rsp’ script in the Library. For more information see the report.rsp section in the Report Options page in the Lianja wiki.
The ‘Lianja Demo’ (lianjademo) desktop App has a local ‘quickreport.rsp’ customized report file that it uses in WebView Sections.


Q:
Is there a lianja/vfp code for me to know that a printer dialog box is cancelled or the cancel button is clicked?
It is because every time I click the cancel button of the printer dialog box the printer is still printing but records are empty.
A:
No that is an operating specific dialog. There is no way to cancel a print operation from it as that is handled by your printer driver.


Q:
Then is it possible to print in lianja without showing the printer dialog box?
payment.print(getprinter(),’portrait’,’native’,”, ‘letter’,1)
A:
I think that if you specify the name of the printer istead of getprinter(), the dialog will not be shown.
E.g.:

Code:
payment.print('HP LaserJet 1022n','portrait','native','', 'letter',1)

You can pick names of all your printers from APRINTERS() like that:

Code:
dimension aaa
xx=aprinters(aaa)
for ii= 1 to xx
    ?aaa(ii)
endfor

I do not know how to tell from that which one is set to default.


For those of you who want to generate HTML formatted reports and print them here are a few good links that are worth reading.

https://www.smashingmagazine.com/201…rint-with-css/
http://stackoverflow.com/questions/3…per-size-pages
https://github.com/delight-im/HTML-Sheets-of-Paper
https://css-tricks.com/almanac/properties/p/page-break/
http://stackoverflow.com/questions/1…ders-in-chrome

wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely “headless” and do not require a display or display service. These are free and open source so you can generate HTML reports and then convert and print them.
http://wkhtmltopdf.org


Q:
I would like to know if any of you use the report tool to generate reports for the application.
I tried from my way, I can’t find the way to have a report with group heading information. I can just get report with group summary, report details and report summary. For example a report grouping details for Order will present these sections:
– report header : title of report, printed date, page number
– group introduction: order number, order date, customer number,…
– report details: details informations of the order: product #, quantity, unit price, total
– group summary: total amount for the order
– report summary: total of all orders.
So form my side, I can only produce header,report details, group summary, and report summary sections.
A:
lib:/report.rsp
you can write your own rsp files and keep them in the library. It would not take much effort to write an invoice,rsp for generating invoices. I’m surprised nobody has.
its such a common requirement, a page with a canvas section for entering customer info and another for entering line items which are refreshed into the invoice,rsp Webview is pretty simple to implement.
A2:
If you look at report.rsp in the library, you will see what with the right HTML, you can create just about anything you want. I’ve done a professional-looking invoice, starting with DreamWeaver. I actually put the virtual table/field names in the “fields” and did string substitution, etc., to make the job easier. It looks great (with adjustments to CSS, etc.)

OTOH, for the main app at my day job, we have a lot, over 150, Crystal Reports, some of them flex (user picks the detail break related tables). For that we’re looking at the Telerik Reporting Engine, because a) it claims to import Crystal Reports, b) it’s still in development; c) it outputs to HTML (i.e., could feed a webview in Lianja) and d) engine distribution is free. We’ll probably have to develop a .Net front-end web service so we can hit it from the Cloud Server, but that’s a small price to pay for what we need. In theory we could use wwDotnetBridge (https://west-wind.com/wwDotnetBridge.aspx) to integrate, but don’t want to confine ourselves to Windows servers for a variety of reasons (one of which is cost; the other is scalability by being able to put the reporting engine on a server other than the Cloud Server).

That said, I think the Lianja Report Writer may end up being what we use. It’s all a matter of timing in terms of our development process. My understanding from the various things Lianja has released about it is that a) design will be done using sections on a page; and b) underneath it will be VFP code (or other languages, I’m guessing), just as with reports.rsp. I see a lot of possibility for innovation, including flex reports, for this methodology, without much work required. Frankly, I’d rather VFP Report compatibility be the last on the list of requirements. VFP wasn’t made for html reports, and we’re in a different era now. For my usage (we don’t use any VFP reports) running an .frx would be best looked at as a conversion program that creates the page and sections etc., added on to the Lianja Report Writer.


Q:
Is report grouping limited to a single field?
If not, how would I write the expression? I tried separating the fields by commas e.g. field1, field2 but that didn’t work. I also tried it as an expression like field1 + field 2 but that didn’t work.

Here’s the second question.
I tried to set the Group by to a field that is not in the field list of the Report Options and I got the same Run Time Error message. Must the field used in the Group By be one of the fields in the field list?
A2:
If you are looking for report.rsp …
There search for “group” (second checkbox for NEXT, first checkbox for PREVIOUS) or view all occurrences clicking FIND ALL

You can figure out how report works and change its behaviour.

A1:
There is no code as such.
If its a report section then look at the attributes. These are postfixed onto lib:/report.rsp to generate the report.
Its one report.rsp file for all reports and it resides in the library workspace.



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s