Modern web\mobile development with ActiveVFP example!

Topics: Developer Forum, Project Management Forum, User Forum
Coordinator
May 7, 2015 at 7:52 PM
Edited May 9, 2015 at 5:43 PM
http://www.noiqs.com/sws_avfp/chc/

Demonstrates:
  • use of themes which can be swapped for others (demo uses Metro theme)
  • new built in PDF generator that can run at shared web hosts like Arvixe
  • Responsive design: works as is on web and mobile. same code base
  • web forms: works as is in both web and mobile
To test:

1) On the left menu, click on Reports & Labels-> Registration & Eligibility -
Notice Of Action (in mobile, click the horizontal lines to get to this menu)

2) Enter your data in the form

3) Scroll down to the bottom and Press “Generate Report”

4) Once the report is generated and shown on screen, scroll down and press press “Print” button.

Works in Chrome, Firefox, IE, Safari
Works in Web or Mobile (iPhone, iPad, Android, etc.)
Note: on iPhone Safari settings you need to enable pop-ups to see the generated
report.



All server-side is VFP code. Existing VFP code can be used.:
  1. NOA Report Form View (noaReportView.avfp). At the start of the view I use
    VFP code to open some tables and prepare data to be shown in the form. This
    code was copied from Init method of Action2014.scx file.
  2. Some of this same Init method code was used to set pre-report code in
    denialReport() method on the NOA REST controller.
  3. Denial NOA report (denialaction2014-1.frx) was reused as it was. The only
    change I made was to exclude the Printer Environment. In fact, the idea for the
    conversion project is to reuse ALL the vfp report formats as they are, without
    changing anything.
General notes:

For a Software as Service (SaaS) running on a web host serving multiple clients,
we'd use this sort of PDF generation. PDFs will work in this application either
remotely or locally (if the app is run on the local LAN)

As an alternative, if this application is running in-house on the local LAN, we
can also generate the VFP report directly to the printer without need for PDF
using this application.
Coordinator
May 7, 2015 at 9:51 PM
Edited May 8, 2015 at 12:39 AM
This was a Proof Of Concept we made for a potential customer looking for converting his VFP Desktop App to a web app. The idea was to reuse as much of the original code as possible.

For this, the customer sent us a report format and the code to prepare that report, taken from his actual app. With this, we created a Single Page Application, using a metro theme. We also used GridForms to create a data entry view and used REST controllers to receive the form data, save it to a DBF file and then call the original FRX report with no changes at all. The output of the report was saved as PDF and returned to the browser for its display on screen.

This probed that although ActiveVFP will require to rebuild the whole UI of your application, it its actually possible to reuse all your biz code and all your reports with minimum effort.

Also, this sample use some of the new features that will be included in the next release of ActiveVFP, including:

1) MVC REST service
2) Built-in reporting and PDF exporting
3) New built-in fast JSON parser
4) New bult-in functions
5) Application Delegate



Victor Espina
Coordinator
May 8, 2015 at 1:55 PM
This is very cool demo. Can't wait for the final release of this new version. Good job Claude/Victor.
May 11, 2015 at 10:00 AM
Very Good. Great job!
Coordinator
May 14, 2015 at 1:54 PM
Hi Victor,

One question on the demo website regarding the report generation. What will happen if the workstation trying to view the report doesn't have an acrobat or a PDF viewer installed?
Coordinator
May 14, 2015 at 5:22 PM
Seemingly all the browsers have built-in PDF viewing\printing support except IE. If there's nothing to bring up the PDF with, I'm assuming it will prompt you in some way to install a PDF viewer.
Coordinator
May 14, 2015 at 6:26 PM
We have some fallback options:

1) As claude suggested, we could redirect the user to an specific error page instructing him to install Adobe Reader to preview reports. This page could also contains a link to download the generated PDF.

2) A variant of the error page could be to show a warning inside the preview area pointing out that PDF preview is not available, with instructions on how to install Adobe Reader and a link to download de generated report.

3) We can redirect the user to an external PDF previewer service, like Google Docs or something link that.


My choice would be 2).

Victor
May 15, 2015 at 3:26 PM
claudefox wrote:
Seemingly all the browsers have built-in PDF viewing\printing support except IE. If there's nothing to bring up the PDF with, I'm assuming it will prompt you in some way to install a PDF viewer.
I think that in this case, the browser give you a download file dialog.
Coordinator
May 15, 2015 at 3:38 PM
apaustria wrote:
Hi Victor,

One question on the demo website regarding the report generation. What will happen if the workstation trying to view the report doesn't have an acrobat or a PDF viewer installed?
At this time the demo check if the browser is a mobile browser or doesn't have any PDF plugin installed. If either of this conditions results true, the demo opens the PDF file in a new browser window. In mobile browsers this results in the PDF being shown in screen. In IE it results in the file being download (I am not really sure about this one).


Victor
May 21, 2015 at 9:22 AM
Hi,

This is very nice. Can you tell me about the UI tool ? How can I use my vfp application existing code in activeVFP ? I am used to compile all my code into a single desktop application.

Regards
Naeem
Coordinator
May 21, 2015 at 10:08 AM
UI is using Bootstrap and jquery. Victor found some excellent mobile ready things like the MetroLab theme and the form creator.

VFP code currently mixed in forms would have to be broken out and put into a VFP MVC controller(s) as methods.
May 25, 2015 at 7:09 PM
Hi Claude,

Thanks for sharing information. This is a very good addition to VFP. Can you give me more information or resources about MVC style controller(s) development.

1) Should I move all my codes in a single Prg file and use it with "set procedure to" or make a dll file from this prg ?

2) How can I update my vfp code in production environment ?

TIA and hope to get a reply.

Regards
Naeem
Coordinator
May 27, 2015 at 3:42 PM
Yes a class or procedure prg like:
oAA=newOBJECT('schedbizobj','c:\avfp6.0Demo\prg\utiltest2.prg')
*OR
SET PROC to 'c:\avfp6.0Demo\prg\utiltest' ADDITIVE * don't forget the ADDITIVE!!

to release in production environment:
*class
oAA=null
CLEAR CLASS ('schedbizobj')

*proc
CLEAR PROGRAM ('prg\utiltest2.prg')
*OR
RELEASE PROCEDURE 'c:\avfp6.0Demo\prg\utiltest'
Victor's new version does this stuff automatically. Look for the download here in this forum someplace. It also serves as the basis for AVFP 7.

So create a controller prg with your main app logic and call the methods or functions from your library.
Coordinator
May 29, 2015 at 1:52 AM
Edited May 29, 2015 at 1:55 AM
As Claude said, next version of AVFP will implement a global garbage collector engine, that will automatically unload any classlib or procedure file loaded with the new AVLoad() and AVNew() functions.

Since other people are also interested in try these new features before the oficial release, I will prepare a download with all required files and a basic documentation of how to install and how to use some of the new features. This will also serve as an unofficial beta test for next AVFP version. Stay tuned.

Victor
Coordinator
May 29, 2015 at 1:53 AM
BTW, REST controllers are automatically loaded and released by the AVFP REST Handler, so you can make changes on production environment without having to restart the application pool.

Victor
Jun 1, 2015 at 7:32 PM
Thank you claude and victor. I will wait for this new download and highly appreciate if you include some usage samples.

Naeem
Aug 10, 2015 at 5:53 AM
Thanks,
Where we can download the source demo of http://www.noiqs.com/sws_avfp/chc/

Warm regards,
mk.
Coordinator
Aug 13, 2015 at 7:02 PM
Mar 17 at 3:19 PM
The links does not work.
Mar 17 at 3:39 PM
The links does not work.
Coordinator
Mar 18 at 5:04 PM
Link is live again.
May 17 at 7:54 AM
How to set it to work on local machine?
Coordinator
May 19 at 2:11 PM
CHC demo is working again. Project can be downloaded from:

http://www.noiqs.com/sos/chc.rar

and last version of ActiveVFP EP (required to run this demo locally) can be downloaded from:

http://www.noiqs.com/sos/avfp6ep.rar
Coordinator
May 19 at 2:14 PM
Dzierom wrote:
How to set it to work on local machine?
  1. Install ActiveVFP 6.03
  2. Download CHC project from http://www.noiqs.com/sos/chc.rar
  3. Download the AVFP extended pack from http://www.noiqs.com/sos/avfp6ep.rar
  4. Copy AVFPEP files on your AVFP main folder
  5. Copy CHC files on a folder inside your AVFP main folder
  6. Make sure your server has the "Microsoft XPS Document Writer" printer installed
Victor Espina
Jun 24 at 1:17 PM
When I carry out the above, the basic page appears but does not display correctly, most icons / images are missing and nothing clicks.

What have I missed please?

Thanks
Jun 29 at 10:56 AM
Also, its Windows 10 IIS

Normal IIS pages diplay OK

Thanks
Coordinator
Nov 3 at 5:10 PM
Activate the Javascript console to check for errors. Post the screenshot so I can help you in figuring out what is wrong.

Victor