PFXplus is a powerful application development tool providing an integrated language, database and screen manager. Its key features are productivity, performance and portability. It is powerful but friendly; it is tightly integrated but open; it is highly scalable and very fast. Over the years, it has enabled thousands of developers to write many fine applications for distribution to countless users.
Over the years, PFXplus has carved out a specialised niche: professional developers writing commercial applications for resale and redistribution. A number of features have contributed to this: the language itself; its ability to support enormous applications and gigantic data files; its excellent performance and robust nature; its lack of bugs; the availability of knowledgeable support; and the portability to different environments.
PFXplus is now ready for the next big challenge, the World Wide Web. Our next product, tentatively entitled PFXweb, will be a powerful addition to the PFXplus stable.
PFXweb is a powerful multi-purpose Web development tool. Like PFXplus, it allows professional software developers to create business Web applications for resale and redistribution. In addition, it can be used to create virtually any Web application that can be expressed in any dialect of HTML and viewed in any Web browser.
PFXweb is a language technology that extends an existing Web server by enabling it to run high-performance data-oriented server-side applications.
PFXweb offers a number of key advantages for developers.
Applications can use the native PFXplus file system to build database applications with a tiny server footprint compared to the cost of running a relational database manager. They can also use any database accessible through an ODBC driver.
Applications can run in a "sandbox", allowing multiple applications to run side by side on the same server without interference and without developers needing privileged access to the server.
Applications can be distributed in compiled form, protecting the original source code when run on third-party servers.
Applications can be developed, tested and demonstrated on a single computer using the Personal Web Server. They can then be deployed to a production server on any supported platform absolutely unchanged.
Existing developers will benefit from the ability to retain and re-use extensive libraries of computation, database access, reporting and batch operations developed in PFXplus over many years.
The PFXweb engine provides all of these features. Based on the existing technology of the PFXplus portable runtime, PFXweb is planned to be available for Microsoft's Internet Information Server (IIS), Apache, and most other servers.
We're very excited about PFXweb, and we shall be looking for developers to become involved during our planned beta testing program. Further details will be announced in the near future.
HyperText Markup Language, (HTML) is the language of the World Wide Web.
The universal adoption of the Web browser has resulted in HTML becoming the common language for all major platforms; Windows, MacOS, and Unix variants. Web browsers have in effect become a "free" runtime with which to access the massive store of HTML documentation available on the World Wide Web. A recent survey reported the existence of over 200 million Web pages, most of which are written in HTML.
HTML has also found wide application for CD-ROM publications and internal corporate communications. Newsletters, staff training manuals, product brochures, pricelists, rosters, orders, invoices, quotations can all be instantly distributed at negligible cost through corporate intranets and extranets for viewing or printing as required. E-mails may contain HTML documents either as embedded pages or attachments.
Documents created in HTML are rendered essentially the same on any platform or screen size and output "what you see" to most printers. The beauty of it is that the user’s browser and computer handle all the hard work, according to the user’s own setup, preferences and budget. The HTML file itself is a short text file which travels quickly down the narrow pipes of the internet. Images, audio and video are not included in the document but instead are referenced by hyperlinks.
Producing HTML from databases is nothing new, as all search engines and most shopping carts, libraries and galleries produce HTML pages from a database, in real time, in response to queries by users.
Powerflex does not yet support databases on Web servers, but is easily implemented over an intranet. A normal Powerflex application can be enhanced to generate a report file in HTML format, which can be routed to any public directory and become instantly accessible to everybody’s browser.
The Powerflex language, including the Reporter and the report macro has long provided a quick and efficient means for exporting data into various text-based formats such as fixed length or comma delimited.
An HTML document can be created simply by replacing all commas with "</td><td>", all linefeeds with "</td></tr>", insert some HTML header information in the /header image and before you know it, the report is ready for publishing on the internal or external Web site.
Before we proceed with a step-by-step tutorial, let us review the basic elements of HTML that we intend to use in our sample report.
The document extension ".htm" or ".htm" identifies an HTML document to the Web browser.
Embedded ‘tags’ form the basis of the HTML language. Pairs of tags mark the beginning and end of each section of script. The following are the essential tags for a page to be displayed by a web browser.
The <head> may contain additional information which is not displayed to browser screen.
<title>The title is displayed at the top of web browser panel</title>
The < body> image contains the script that is to be displayed on the web browser screen.
Text embedded in the following tags is not displayed, so becomes a ready means for inserting comments into the document.:
<!-- The contents of this tag are not displayed & may be placed anywhere in the web document. -->
The HTML specification includes up to 50 layout tags which may be embedded in the <body> section to determine the appearance of the displayed document. However not all tags are supported by all browsers, and all HTML development must keep backward compatibility with older browsers in mind.
The <table> tag and its associated elements are common to all browsers, and present a ready-made framework for displaying data tables and lists. The individual table cells may contain text, images or nested tables. Tables within tables can produce creative effects with graphic and text.
The commands that we will utilise in our report will include:
<table><!-- marks the start of table.-->
<tr><!-- marks the start of a row within a table.-->
<td>column cell in which text & images are rendered.</td>
<td width=200px>cell will be 200 pixels wide.</td>
<td align=right>cell contents will be right-justified.</td>
</tr><!-- marks the end of a row within a table.-->
</table><!-- marks the end of table.-->
The HTML specification includes text attribute tags which affect the appearance of the displayed text. For our purposes we include the following tags:
<h1>text will be emphasised according to browser settings.</h1>
<h2>text will be emphasised according to browser settings.</h2>
<h3>text will be emphasised according to browser settings.</h3>
<b>text will be bold.</b>
To start our HTML report we will first create a template from a standard PFX report using Powerflex Reporter.
Let us create a new working document by opening members.pfr and saving it as member2.pfr, keeping the original file in case we need to revert. We will now proceed through the code line by line.
open member index.4 file_mode member read_only direct_output 'member2.htm' [err] inkey$ [err] abort move 0 to pageend
section header sysdate header.1 // print pagecount to header.2 output header
output total REP_FILE_DONE 'member2.htm'
That’s it. Compile the report, run it then view the finished page on your browser.
There is an infinite variety of ways to enhance the appearance of HTML documents, many of which, such as Cascading Style Sheets, are not fully supported by all browsers. Others require plug-ins that users might not have.
The ability to include images in our document by hypertext link to anywhere on the World Wide Web presents rich possibility for artistic license. However images are bandwidth hogs and users will not wait long for fancy "flasturbation" to download. Many Web designers achieve very satisfactory and consistent look and feel at the lowest possible overhead, by judicious use of corporate logos, background colors and various fonts and spacings.
The following example illustrates some of the more widely supported methods for enhancing the layout of HTML pages.
Let us open member2.pfr and save as member3.pfr, which will save the original file and allow us to continue our modifications in member3.pfr.
file_mode member read_only direct_output 'member2.htm'
section total print 'Total Winnings' subtotal body.4 output total REP_FILE_DONE 'member3.htm'
In this article we have covered the basic syntax for HTML, and how it may be combined with a standard Powerflex report to produce a ready-to-use web page.
With members.pfr we have reviewed how to prepare a basic report template from Powerflex Reporter.
With member2.pfr we have incorporated the following methods and elements.
With member3.pfr we have added the following enhancements.
In another article we will enquire into the differences between Netscape 4x, and W3C compliant browsers, and how they effect page rendering. Although Netscape 6 will be compliant with W3C open standards, Netscape 4x represent the largest installed base of any browser, so HTML developers need to ensure backward compatibility for some time yet, while utilising the advanced features of Netscape 6 and IE5.
Among the host of useful new features included in PFXplus version 5.0 is an all-new TOOLBOX for Windows. The new TOOLBOX includes all of the features of the previous versions plus some extra capabilities which come in very handy.
You will recall that previous versions of TOOLBOX automatically create a Quick Entry Program for the specified DAT file, enabling you to quickly add and modify the data without having to manually write a program yourself to do so.
The new PFXtoolbox includes this capability plus a whole lot more. Not only does it automatically create a Quick Entry Program, it also automatically generates the equivalent Windows program.
Generated Windows programs may optionally include Menus, Toolbars, Status Bars and more by implementing the Common Control Architecture (CCA) tools.
Following is a list of the available options:
The end result is a superbly written Windows program which makes full use of 32-bit Windows features and looks great.
Even if the entry program is too simple for your customer’s needs, it makes a great template on which to base your Windows programs. You can build on top of it as you require.
The following figure is an example of a generated Windows program for the Members sample data file. The screen has not been modified using the Dialog Resource Editor, hence the extra height and width of the dialog (not shown here).
This program includes fully-working Menus, Toolbar, Status bar, Windows messaging, buttons, Help and more under the Options menu.
PFXtoolbox does all of this for you at the click of a button. Simply select the Make CCA Program tab and click Create.
To order your copy of PFXplus version 5.0, please contact Powerflex Corporation or your nearest dealer.
Further details about PFXplus version 5.0 are available on the Powerflex Web site.
At first I thought that accessing SQL tables from my PFXplus programs was going to be a real challenge. I couldn’t escape the idea that converting PFXplus data files to SQL tables and storing them on the server would inevitably require massive code changes to access them.
To my surprise, I found that I was able to access my own PFXplus data in Mark 5 format in a SQL Server database just as I would a normal PFXplus data file, with minimal code changes. And I was easily able to execute SQL queries in my PFXplus source code on third-party databases as well.
The following two sample programs separately demonstrate the above SQL capabilities. The first sample, SQLCUST.PFX, demonstrates how to execute a SQL query on an Access database from within a PFXplus program, and output the result set.
First a connection must be made to the Data Source; see below. (Of course you need to set one up beforehand to point to which ever database you would like to access). In this case the Data Source Name is "MSADSNdirect", the user name is "pfxuser", and the password is "password".
trap SQLEXEC "@connect MSADSNdirect, ; pfxuser,password"
The next step is to execute the SQL query on a selected table or tables. In this case the selected table is called "CUSTOMER". The result set is saved to a temporary file, file(999).
SQLOPEN ("select CUSTOMERID, ; COMPANYNAME from CUSTOMERS ; order by CUSTOMERID") ; as file(999) // Retrieve row from result set SQLFETCH file(999) while found field(999,0) = 0 saverecord file(999) SQLFETCH file(999) end SQLCLOSE file(999)
Run the program with the PFXplus SQL runtime and observe the results.
The second sample program, ORDLINES.PFX, demonstrates minor code changes that may be necessary when working with Mark 5 (SQL) data files. Mark 5 files are accessed in exactly the same way as Mark 1 to 4 data files; however, with SQL all updates are performed within transactions. Each transaction starts with a LOCK or REREAD and ends with an UNLOCK. The performance of SQL updates within locked transactions prevents undesirable effects, including lost updates and accesses to uncommitted data.
PROCEDURE SaveDetails file_mode ORDHDR DEFAULT file_mode ORDLINE DEFAULT on error gosub errHandler reread // Start Trans entupdate saverecord ORDLINE ORDHDR.TOTAL = CalcTotal() saverecord ORDHDR unlock // End Trans file_mode ORDHDR READ_ONLY file_mode ORDLINE READ_ONLY entdisplay ORDHDR exitSave: exit errHandler: unlock notifyOK EL_WARN ("Err on save"; +"Trans rolled back. No changes.") err = false on error off return exitSave // Abort Trans END_PROCEDURE
Note the way in which errors inside the transaction are handled. If an error occurs any updates are rolled back by aborting the transaction and any further attempt to update the database before UNLOCK will also fail.
Both of the above sample programs, SQLCUST.PFX and ORDLINES.PFX, are available for download from this Web site.
It’s dead easy to convert a report that prints through MS-DOS into one that prints through Windows in a standard Windows environment. And why not, if it enables you to take advantage of the capabilities of Windows printing to get your reports looking that much better?
Here is an example of just how easy it can be to convert.
Begin with a basic report that prints via MS-DOS.
Change the following code, which prints output to the LST or LPT devices that write to a default printer set by the sPrintPath configuration item.
outfile "LST:" or outfile "LPT1:" or direct_output "LST:" or direct_output"LPT1:"
This will send the report output to the default Windows printer. WINLST lets PFXplus tap into the existing capabilities of the Windows printer you are working with. You must ensure that the Windows printer is set up correctly on the machine you are using.
If you would like to give the user control over which printer is used, you can add a procedure to your report to display the standard Windows Print Dialog from which the user can select the required Windows printer.
An example of a procedure to do this can be found in the PFXplus version 5.0 sample program, WPRINT4.PFX.
The report now prints under Windows using the default or selected Windows printer. It really is that easy. But wait, there’s more…
While we’re at it, let’s change the report to print using the Arial font, rather than the outdated monospaced Courier font. Why, you ask? Because printing with proportional fonts is no longer a pain in the rear end when printing with PFXplus version 5.0.
We can take advantage of the new WINOPT option for the WINLST and PREVIEW output devices. This means that the old way of having to provide the printer head with exact co-ordinates of where to print data so that columns were nicely aligned, is now obsolete. WINOPT does all the work for you!
To implement WINOPT, simply change the line
direct_output "WINOPT:3 WINLST:"
This has the effect of automatically aligning columns of data, as well as replacing "-" and "=" with Line Draw characters.
Now to modify the program to use proportional fonts. See below.
csi = character(27) headerFont = (csi+'"Arial"F'+csi+'16P') bodyFont = (csi+'"Arial"F'+csi+'10P') print headerFont to header.1 print bodyFont to header.4
Voila! All columns are fully aligned, and the new font looks great. You have a report that prints to the selected Windows printer, and is aesthetically more pleasing, with the minimum of work on your part.
A free upgrade for the Powerflex ODBC driver version 1.0 is now available. The upgrade corrects some reported problems with the Powerflex ODBC driver.
For your free upgrade please contact Powerflex Corporation; a copy of PFXodbc version 1.10 will be e-mailed to you upon request.
Powerflex Corporation has just released PFX C-lib version 5.0. This new version of the C-libraries comes with:
For further information please contact Powerflex Corporation or your closest dealer.
PFXsort version 5.0 has just been released. New features of PFXsort version 5.0 include:
For further information please contact Powerflex Corporation or your closest dealer.
|Powerflex Developer's Kit 16/32-bit||4.23|
|Powerflex Developer's Kit 32-bit/SQL||5.00|
|Powerflex Runtimes||2.63 to 5.00|
|Powerflex HP 9000, Motorola||4.11|
|PFX C-lib MSDOS—DOS-386||4.20|
|PFX C-lib for Windows||5.00|
|PFXsort for DOS-386, Win32/SQL||5.00|
|PFXbrowse 32-bit with Btrieve||2.00|
|PFXbrowse 32-bit for Windows||4.00|
|Powerflex ODBC Driver||1.10|
|Powerflex Driver for Crystal Reports||1.01|
For further information contact Powerflex Corporation or your local dealer.