Creating report in lansa 14.2

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Pratibha
Posts: 15
Joined: Wed Oct 31, 2018 6:53 pm

Creating report in lansa 14.2

Post by Pratibha »

Can anybody please guide how to create report in Lansa. The requirement is upon clicking the push button on the form the report should appear on the screen and the user should be able to print the report.

Regards,
Pratibha
jyoung
Posts: 694
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

Re: Creating report in lansa 14.2

Post by jyoung »

I think we are probably going to need some more information as to your environment.

Are you using VLWEB or VLWIN or the 5250 screens?

I use the PDFDocumentService https://docs.lansa.com/14/en/lansa093/i ... 7_0170.htm with Integrator to handle pretty much all of our reporting. We typically email these to the user, however you could store these on the server and access them through the web.

VLF-ONE has a demo DF_T69H1O that shows a way to handle printing in VLWEB.

Joe
Last edited by jyoung on Fri Dec 07, 2018 2:46 am, edited 1 time in total.
Pablo
Posts: 48
Joined: Wed Dec 02, 2015 10:35 am

Re: Creating report in lansa 14.2

Post by Pablo »

Hi Pratibha,

Further to Joe's reply, in case this is what you are after, the PrintExample.zip attached is a quick export with a couple of examples part of the VLF demo that will work in a normal page. It will import these components:

PrintPage - web page
PrintInterface - reusable part to communicate with the widget
PrintWidget - widget
PrintResource - external resource used by the widget pointing to the file included in xWebSamplesPrint.zip

xWebSamplesPrint.zip contains a JavaScript file you must extract to your partition web vl folder.
For example: <lansa root>\X_WIN95\X_LANSA\x_<partition>\web\vl\

PrintPictures.zip is what you should expect when you click on Preview/Print. A page showing you examples of the things you do in the widget and another with some sample barcodes.
Attachments
PrintPictures.zip
(71.19 KiB) Downloaded 3764 times
PrintExample.zip
(42.94 KiB) Downloaded 3686 times
xWebSamplesPrint.zip
(13.81 KiB) Downloaded 3481 times
adale
Posts: 210
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Creating report in lansa 14.2

Post by adale »

Pablo,
I am trying to implement your web print samples in a VL web application (V15).
I have extracted your provided resources, compiled, and checked in.
When I try to run it, I get the error:

Fatal Error:
Cannot set properties of undefined (setting 'ReportPages')

Looking in the PrintWidget, I see the reference but am unclear as to the issue, as I really no know js at this point.

Any help is greatly appreciated.

// uClearPages - Clears any added pages.
//
PROTOTYPE.uClearPages = function()
{
// Implementation...
this.Report.ReportPages = [];
}
Arlyn Dale
Servias LLC
adale
Posts: 210
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Creating report in lansa 14.2

Post by adale »

My bad. In my VL dialog I missed the EVTRoutine handling uPrintWidgetInitialized. It is now working and the fun begins on print output design and data work. Thanks.
Arlyn Dale
Servias LLC
adale
Posts: 210
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Creating report in lansa 14.2

Post by adale »

Has anyone else worked with this report creation / printing method (in VLF or Web)?
I have just starting working with this, but the generated report seems "fuzzy", the characters on screen and print are not quite a sharp as would be expected? Is there something I am missing, or something I can adjust for a "cleaner" report?
Attachments
Report Preview.pdf
(13.76 KiB) Downloaded 3282 times
Arlyn Dale
Servias LLC
adale
Posts: 210
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Creating report in lansa 14.2

Post by adale »

*Note - I am working in V15, with the latest epc 150050 if that makes a difference.

The previous provided web printing examples are working fine in a VL Web View or Dialog.
Now I am trying to move the printing specific portion of the code to a RUP (to clean up the view/dialogs code, and to make the same report printing usable across multiple dialogs), but am running into a problem.

In the views/dialog, the printing function requires the init of the report "PrintInterface" RUP as:

Code: Select all

* Interface with widget.
DEFINE_COM Class(#PrintInterface) Name(#OptionsReport)

EVTROUTINE Handling(#OptionsReport.uPrintWidgetInitialized)
#OptionsReport.uInitialize Getwidth(#MaxLeft) Getheight(#MaxTop)
ENDROUTINE
When I try to utilize the same code, along with the required "define_com", etc., I get an error page displaying:
Fatal Error:
Cannot set properties of undefined (setting 'ReportPages')
Location:
Reusable Part: PrintInterface, line 137
Call Stack:
1. Evtroutine Handling(#Button.Click): LS8TestWebPrint, line 13
2. Mthroutine Name(PrintPreview): LS8TestWebPrint, line 19
3. Mthroutine Name(PreviewOptions): LS2WebPdfPrintInterface, line 56
4. Mthroutine Name(uClearPages): PrintInterface, line 137

In the browser console window, it does look like the PrintInterface and PrintWidget have been initialized, or at least they show up with status 200.

When in a RUP, does a different method need to be used to init the PrintInterface/PrintWidget?

Is there a conflict or special method to have one RUP trying to execute another RUP?
Arlyn Dale
Servias LLC
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Creating report in lansa 14.2

Post by Dino »

Hi Arlyn

If you are in 15 now, and you want to create pdf in the client side why don't you use the now native prim_pdf?

https://docs.lansa.com/15/en/lansa016/C ... IM_PDF.htm

If you want to create in the server side, then use integrator pdfdocument service, it creates the pdf in the ifs and then you can display the result pdf in the web
adale
Posts: 210
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: Creating report in lansa 14.2

Post by adale »

Hi Dino,
Simple answer is that I had originally started this work back when we were on 14.2, and did not realize there was an new Prim_PDF feature.
I don't see this listed in the Lansa IDE Samples, but looking at the support docs, it seems pretty straight forward.
One item I don't see, is that in the previous print widget, once the PDF was generated (client side on the web) it would open up in a window automatically to view. In the Prim_PDF, I see the "save" feature, but is there a "preview" or "view" feature without having to save it first?
Arlyn Dale
Servias LLC
Post Reply