The Internet changes everything...You will have heard it said, so you may be wondering why things seem very much the same. The DotCom bubble has been and gone. Perhaps you are thinking it was just a flash in the pan, a nine day wonder, much ado about nothing. At Powerflex Corporation we are convinced otherwise.
The first generation Internet was all about being seen, having a presence, capturing eyeballs. The bubble burst when investors started to understand that eyeballs did not translate into profits.
So what is the Internet really about and why should business care? How do you make profits from clicks?
The Internet is simply a very low cost, universal communication medium for data. In a few years, when broadband connections are everywhere, businesses will be able to communicate with their customers, suppliers, partners and regulators quickly, cheaply and continuously. That makes for boundless new possibilities.
Do not expect to achieve a competitive advantage from just being on the Internet. Since everyone has it, it's not what you've got but what you do with it that counts. Likewise, do not try to use it simply to reduce costs. Everyone else is doing that too, so there is no advantage in it.
The businesses which will thrive and prosper with the Next Generation Internet will be the ones which come up with new, valuable, innovative products and services, and charge a premium for doing so.
Suppliers, offer your customers direct access to the progress of their order and their account status. Architects, let the customer watch the building works on WebCam. Salesmen, submit your orders directly from the field. The possibilities are endless.
Powerflex Corporation products targeted at transactional data processing have not had a place in the Internet so far. We believe that the Internet has now matured to the point where our products will be needed.
We are now proud to announce the Beta release of PFXweb, our first product for data-driven Web sites and transactional data processing on the Internet.
PFXweb allows you to use all those other great design tools to actually build your Web pages, and then adds serious data processing. Whether it is simply to add reports and calculations to existing pages, or to add data entry forms for processing transactions, PFXweb can do it.
This is a beta release, for early adopters and to help us to refine the product. Please try it, use it and send us feedback so we can make it even better for you.
Together we shall be ready for the Next Generation Internet.
This article is about our great new product PFXweb, which opens up the use of PFXplus code in web applications. It shows a step by step process by which the member database from the PFXplus distribution samples can be viewed and modified using nothing other than a web browser.
It describes the creation of web pages using standard HTML with Active Server Pages (ASP) code to activate a PFXweb object. PFXweb should be installed on a web server. If this has not already been done, use the instructions that come with the product to install it and test that it has been installed correctly. PFXweb is implemented as an activeX Control PFXCOM.DLL which must be registered as part of the installation process.
HTML coded pages can be created with any text editor although the use of an HTML editor makes the task so much easier. The basics for setting up a HTML page with a title, a footer and a table with 1 column and 2 rows is as follows.
<html> <head> <title>Database Viewer</title> </head> <body> <table> <tr><td>Column 1, Row 1</td></tr> <tr><td>Column 1, Row 2</td></tr> </table> <hr> Page brought to you by Powerflex Corporation </body> </html>
The <table> and </table> tags define the start and end of a table, <tr> and </tr> define the start and end of a row within the table and <td> and </td> define the start and end of a column within the row. The <hr> tag defines a horizontal line.
For this exercise this page is called "index.asp". The first row is used as a header showing the field names of the Member database and the second and successive rows for data. The column names and the column data are provided by a PFXplus module.
The PFXweb object accesses PFXplus exported string variables, functions and procedures. The exported functions must have a string argument and return a string. The exported procedures must have two string arguments. To link the PFXweb object to a PFX module place the following ASP code before the <html> tag in the previous block of code. This would be included at the top of every ASP page where PFXweb is to be used.
<% option explicit dim pfxsys set pfxsys=Server.CreateObject("PfxCOM.PfxSystem") dim pfxcom set pfxcom=pfxsys.LoadModule(Server.MapPath("index.ptm"))
' Function to return a value from pfxplus and HTML encode it function GetValH (s) GetValH = Server.HTMLEncode (pfxcom.Value(s)) end function<
' Function to call a pfxplus function function CallPFX (s) CallPFX =pfxcom.CallFunction(s,"") end function %>
The <% and %> indicate the beginning and end of ASP code.
The code above creates a PFXweb system object and uses the LoadModule method to load a PFXplus module (called index.ptm) which is required to be in the same directory as the index.asp file. This is analogous to a normal PFXplus program using a module. The following examples show the basic ASP code for displaying exported string variables and calling exported functions.
<% =pfxcom.Value("HEADERNAME") %> <% pfxcom.CallFunction("GETHEADER","") %>
To make this easier the functions GetValH and CallPFX have been included.
The code used in this exercise is available as a download from this website. The zipfile contains five files which are extracted into two separate folders. Listings 1 and 2 (see below) are the Part 1 index.asp and index.pfx files. Part 2 consists of the amended index.asp and index.pfx as well as the additional editpage.asp (Listing 3).
The code in listing 1 uses two exported strings - HEADERNAME which is the heading for a field and VAL which is the data for a field. It also uses three functions. The first is GETHEADER which gets the next HEADERNAME and returns an empty string if there are no more fields. The second function GETNEXTROW gets the next row of data and the last function GETNEXTCOL puts the data for the next column into VAL. The ASP code 'do while... loop' construct outputs the HTML that it contains until the while condition becomes false.
The PFXplus code in listing 2 implements the exported strings and functions.
Compile the program to produce index.ptm.
Copy the index.ptm, index.asp and the member.dat and member.k? files to a directory on the server, ensure that this directory is a virtual directory with read and script privileges under IIS.
On a workstation, open up index.asp using a web browser. The address (URL) to use should be http://server/virtdir/index.asp, where server is your server name and virtdir is the virtual directory on the server. You should see something like Figure 1.
Because of the limitations of space for this article, enhancements to this page such as background color, bitmaps, titles have not been included. Check in a book on HTML on how to do this.
If an error is reported to the web browser, the installation documentation shows how to turn on logging in PFXweb. This can be useful in tracking down problems.
The order for the initial display of data displayed is by Index.1. To enable the user to choose an alternate index, two exported strings INDEXNUM and FINDINDEXNUM should be added to index.pfx.
export string INDEXNUM export string FINDINDEXNUM
In the function get_col_info add the following line before the SWITCH statement
INDEXNUM = 0
after the line
WHEN 1 INDEXNUM = 1
and after the line
WHEN 2 INDEXNUM = 2
In the function GETNEXTROW replace the line
find gt member by index.1
idx = FINDINDEXNUM find gt member by idx
These changes set INDEXNUM for the Number and Surname columns and records are found by index FINDINDEXNUM.
In index.asp add the line
pfxcom.Value("FINDINDEXNUM") = Request("index")before the first %>. This line sets FINDINDEXNUM if there is an index parameter specified after the URL address.
Still in index.asp replace
<td><% =GetValH("HEADERNAME") %> </td> with <td> <% if GetValH("INDEXNUM") <> "0" then %> <a href="index.asp?index=<% =GetValH("INDEXNUM")%>"><% end if %> <% =GetValH("HEADERNAME") %> <% if GetValH("INDEXNUM") <> "" then %> </a><% end if %> </td>
This code checks for a column with a non-zero INDEXNUM and where found uses the <a href="URL-of-Link"> HTML tag to set a link back to this page adding the index number as a parameter. This could also be done on initial loading of the page by specifying the requested index as a parameter at the end of the URL. (e.g. http://server/virtdir/index.asp?index=2)
Compile index.pfx again, copy index.asp and index.ptm to the server and reload the web page. The column headers that can be used for alternate indexes will now be highlighted and when clicked will redisplay the page according to the selected index.
Columns containing numbers such as Number, Rating, Played and Winning are better displayed with right justification. To do this index.pfx is modified.
export string VALADJUST
Before the SWITCH statement set the default justification
VALADJUST = "left"
and after a WHEN statement for a column which needs right justification
VALADJUST = "right"
and replace the function GETNEXTCOL with
export function GETNEXTCOL; string arg returns string increment colcnt result = get_col_info() if result ne "" val=; field (memberfnum, colcnt) end_function
In index.asp replace the <td> AFTER the line
<% do while CallPFX("GETNEXTCOL") <> "" %>
<td align="<% =GetValH("VALADJUST") %>">
Recompile, copy the new files to the server and check to see that the specified columns are now right justified.
Now we can view the data but how about changing it. We need a way to ask the user which record to change or perhaps add a new record and also the values for each field. The code for index.asp is modified to call a new ASP page (editpage.asp) passing to it the record number for the row to be changed. A record number of 0 is passed to add a new record.
In index.asp add the following code before the <table> and again after the </table>.
Click on the Edit Column to edit or delete a record or
<a href= "editpage.asp?recnum=0"> here</a> to add a new record
After the first <tr> add the following to create a new column with a blank heading.
After the second <tr> add the following to put a link to the new editpage.asp passing the record number.
<td><a href="editpage.asp?recnum= <% =GetValH("ACTRECNUM") %>"> Edit=></a></td>
The record number is supplied by the exported string ACTRECNUM. (The > is the HTML way of saying a > when you don't want it to be a tag.)
In index.pfx make the following changes.
export string ACTRECNUM
actrecnum = field(memberfnum,0)
after the find statement in function GETNEXTROW
Now the page should look like Figure 1, but with an 'add' link at the top and bottom of the table and an 'edit' link at the start of each row. As yet these links have no edit page to go to.
You are probably familiar with the forms which allow you to enter information into your browser. In HTML these are implemented using the FORM and the INPUT tag. Here is a basic form that allows the entry of a single item and push buttons to submit or reset the information
<html> <head> <title>Member Database Editor </title> </head> <body> <form action="editpage.asp" method="post"> <table> <tr> <td>Surname</td> <td><input name="Surname" type ="text" size=20 value="Smith"> </td> </tr> </table> <input name="save" type="Submit" value="Save"> <input name="reset" type="Submit" value="Reset"> </form> <hr> Page brought to you by Powerflex Corporation </body> </html>
The input tag specifies a name, a type, an initial value and some other parameters, which cause the browser to display a control and to allow data entry. The submit type when placed in a form causes the action specified in the form tag to occur when the button is used. In the case above, this action is to POST the data to the page editpage.asp (which means back to this form and unless someone does something we will be here forever).
When the data is POSTed to the page it can be retrieved using the same method we used to retrieve the index parameter in index.asp - the Request function. It is also possible to use an input tag with a hidden type which will not display on the form but its value will be posted when the submit button is used. In the code for editpage.asp below, the request method has been used to collect the information entered by the user and hidden data set by the PFXplus code. This information is used to control the action when the page is reloaded after the submit button is clicked.
The first few lines in listing 3 are the same as index.asp where the pfxsys and pfxcom objects are defined. The Request method is used to find the recnum, the values of the submit buttons and the values of the input data fields which are stored in the PFXplus module. Note that the data is stored in an array which is referenced using the Array Method of the PFX Module Object.
In the body of the code, PROCESSFORM is called which checks if the save or delete buttons have been clicked and acts upon them. If not, the form is displayed using the data provided by GETROWDATA.
Index.pfx is further modified to add the code to support the extra export variables
export string DISPLAYSIZE export string DISPLAYDATA export string DATANAME export string DATAARRAY  export string DATAVALUESSAVE export string DATAVALUESDELETE export string RESULTINFO
After each WHEN statement set the DISPLAYSIZE to the size for the required field. For example
This sets the size of the text box where the user enters the data for each column.
We now need to add the function PROCESSFORM which processes the data after the user has clicked the save or delete buttons. Quite a bit of code is added to check which button has been clicked, to save or delete or add a new record and to indicate success or failure. The code to be added is in listing 4, which can be viewed separately and is also available for download from this website. Finally add
statement at the top of the file
Recompile index.pfx and copy the updated index.ptm, index.asp and the new editpage.asp to the server. If all has gone well you should see a page like Figure 2 if you select to edit the record with Surname PANOV.
The most fundamental difference in running a web application from the standard applications that we are used to writing is that, by the time the user sees a page the program itself has exited. The program restarts every time a new page is requested and uses the data provided by the user to work out what to do next.
Perhaps you are asking - Do I have to write all this code for every page I wish to put up on the web? The answer is no. Powerflex Corporation will be releasing development tools that include template ASP pages and PFXplus code. The code implements commands that are very similar to ListView and Entergroup. These commands can be used to set up viewing and editing of web based pages and provide much more functionality than described in this article.
May I suggest that you start looking into using PFXweb with your product because if your customers haven't asked you about web based applications, they soon will!
If you would like to part of the beta testing for PFXweb, contact us by phone (61 3 9888 5833) or email (email@example.com).
Powerflex is pleased to announce the release of Service Pack 1 for version 5.0 Windows 32 bit. This Service Pack contains minor fixes and enhancements to version 5.0 of PFXplus (Developer and End-User Runtimes), PFXcrystal and PFX C-lib.
Service Pack 1 contains only updated files and requires that a licenced version 5.0 copy of PFXplus, PFXcrystal, or PFXC-lib be already installed.
Service Pack 1 will be shipped free of charge with all future version 5.0 orders of the above products.
For customers who already have bought a version 5.0 copy of PFXplus, PFXcrystal, or PFXC-lib, Service Pack 1 is available through one of the following methods:
Contact us by phone (61 3 9888 5833) or email (firstname.lastname@example.org) for details on how to get your copy.