December 2005: Volume 14 Number 2

PFXweb | XP style | PFXcrystal 5.1 | Technical tips | News, products update

Ajax, PFXweb and the new Internet

David Bennett – MD Powerflex Corporation – Australia

The Internet solves so many problems, not least being connecting people in diverse locations with the software and data they need to do their work. Although the Internet was first seen as a medium for publishing documents, and has become the most amazing means of advertising and locating goods and services, its use for conducting business has been slower to develop. Partly this is because the tools for developing Web-based applications remain weak, migration tools are almost non-existent and the user experience is primitive. We have all been through the painful experience of buying something on-line; few businesses would want to run their entire application suite on something so awkward to use.

Ajax is the new new thing

The latest technology revolutionising the user experience is called Ajax, which is short for Asynchronous JavaScript And XML. In the words of Jesse James Garrett (read more):
"Ajax isn't a technology. It's really several technologies, each flourishing in its own right, coming together in powerful new ways. Ajax incorporates:

The traditional Web application interacts with the server only when the user presses the Submit button, and then clears the screen whenever it redisplays anything. The Ajax application interacts continuously as it needs to, and maintains a rich, stable and responsive user interface.

PFXweb is Ajax to the core

The good news is that PFXweb is Ajax to the core! Although Ajax has only recently been widely recognised and given a name, PFXweb was built using exactly this technology from day one.
Not only is the user experience familiar and highly responsive, but PFXweb will also be familiar to the developer. All the existing screen, business logic and database code still works as it always has, while the new user interface is built out of the standard components of Ajax: HTML, CSS and XML.

Migration of existing programs becomes a routine and straightforward exercise. We do not expect all our developers to convert their applications to PFXweb right away, but there is comfort in knowing they could.

New features and new products

If you have not already joined the PFXweb beta program or our VAR program, now would be a good time. The first production release of PFXweb will be very soon, and the development system will be free to all VAR members at the time it is released.

Top of Page

PFXplus applications with that XP look - for free

Chris Peskett - SS&C Technologies, Inc. - USA

So you've spent thousands of Dollars (Pounds, Yen, Marks, Lira) to develop your PFXplus application in Windows, and it looks all nice and spiffy, and along comes Windows XP, and all of a sudden, your bright, shiny, spiffy program just looks like yesterday's dinner. And now the boss has noticed and you've got one month to make it all look better, and NO, you can't have a new developer or six to help.

Don't start pulling out your hair, or slicing your wrists, because there is a solution that is SOOOO simple, it will make you look like a hero! Okay, maybe a little exaggeration there, but it really does do great things with no expense, and very little time.

Manifest files are the answer

The answer is Manifest Files. A Manifest File is a special form of XML file that enables XP styles for applications (generally, EXE files). A Manifest File has a specific naming convention - appname.exe.manifest - and for the most part, has consistent contents. Based on research done by one of our developers at SS&C, we were able to create a generic Manifest File that works with most of the EXE files we use in our largest application CAMRA - and most specifically, with the PFXplus Win32 runtimes (PFLN and PFLNS). The contents of pfln.exe.manifest are:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
  xmlns="urn:schemas-microsoft-com:asm.v1"
  manifestVersion="1.0">
<assemblyIdentity
   processorArchitecture="x86"
   version="1.0.0.0"
   type="win32"
   name="pfln.exe"/>
   <description></description>
   <dependency>
   <dependentAssembly>
   <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls"
      version="6.0.0.0"
      publicKeyToken="6595b64144ccf1df"
      language="*"
      processorArchitecture="x86"/>
   </dependentAssembly>
   </dependency>
</assembly>

Anyone familiar with XML coding will recognize, if not the actual elements, then certainly the formatting and tag style. Being an XML file, it can be created and edited using any standard text editor, including Windows Notepad or Wordpad.

Note that the specific EXE name, in this case PFLN.EXE - is referenced in the file, as well as being part of the filename. The Manifest File must reside in the same folder as the EXE file.

We have been successful in creating Manifest Files for most of the PFXplus executable programs (PFLN(S)(D), PFXbrowse(s), PFXDRE) and the change in visualization is striking. In fact, we have been able to reuse this same file for many of the EXE elements of our system outside of the PFXplus realm. There are limitations, and some applications can cause Out of Memory errors, but all of the PFXplus programs run perfectly.

Creating a manifest file

The examples below illustrate what can be achieved by simply creating a Manifest File. The screenshots are from the sample program ORDERSP.PFX provided with PFXplus.

Figure 1 shows ORDERSP as executed in a non-Windows XP environment, basically what everyone is used to from Windows, fairly elegant, but nothing special.

Figure 2 shows ORDERSP running on a Windows XP machine. The overall form visual has changed, and any Common Controls (such as the Listview shown below) used on the form will change because of the newer COMCTL32.DLL used in XP, but otherwise, it's just the same old program.

One simple xml gives you XP appereance

Figure 3 shows ORDERSP running under Windows XP and using a Manifest File. Windows XP is identifying the Manifest File as being linked to PFLN.EXE, and applying styles to the running application based on the information fed to it from the PR3 file and the runtime. Note specifically the change in visual appearance for the Toolbar (flat by default), Group Boxes, Command Buttons and Edit Boxes. These are standard to the XP style. What does not change is the "button" portion of the EditWithButton, since this is a custom control, and has no XP equivalent.

Voila! With the creation of one simple XML file, created with a basic text editor, you have Windows XP style. Checkboxes, Radio Buttons, Progress Bars all take on the standard Windows XP appearance (see Figure 4 below).

Five minutes work and you have an XP-style application to be proud of. Sample Manifest Files are available for download from the Powerflex website.

Top of Page

PFXplus data files and Crystal Reports

Eva Meisel - Powerflex Corporation - Australia

Reporting is an integral part of most PFXplus applications. Some PFXplus developers write reports directly in their PFXplus programs, while others may opt for a third party, non-PFXplus reporting tool, such as Crystal Reports. Using Crystal Reports with PFXplus applications is quite easy - install the PFXcrystal driver and start Crystal Reports (CR) to create visually appealing and functional reports from PFXplus data files.

What's in PFXcrystal 5.1

PFXcrystal 5.1 for Crystal Reports 9 (referred to as CR 9) and 10 (CR 10) is distributed on a CD and is installed as per the instructions on the CD. The installed software includes 2 DLLs and 2 configuration files:

Enter PFXcrystal licence details to both configuration files p2bpfx.ini and u2lpfx.ini.

Then copy p2bpx.dll, u2lpfx.dll, u2bpfx.ini and u2lpfx.ini to the following subdirectories of c:\Program Files\Common Files\Crystal Decisions

We will now refer to these directories as \bin\2.0 and \bin\2.5 respectively.

Using the crystal bridge

Note that CR 9 and CR 10 enable native connection to PC databases via a crdb_p2b*.dll, which is a bridge dll between CR and the database driver itself. This bridge is supplied with CR as a so called crdb_pc wrapper dll. The location and the name of the crdb_pc wrapper may differ between versions (9 and 10) and editions (Standard, Professional, Advanced, Developer) of CR therefore it is best to consult your specific CR documentation for details about crdb_pc.dll.

PFXcrystal with CR 9 is easy

Copy the crdb_pc.dll wrapper from the Tools\Extras directory of the CR 9 installation CD to \2.0\bin directory. Rename it to crdb_p2bpfx.dll, open CR 9 and you are ready to report from PFXplus and compatible .dat files.

PFXcrystal with CR 10 made easy

The Crystal Reports 10 documentation shipped with the product is very short on detail about the location and use of crdb_ files for accessing native/PC databases such as Act, Btrieve, Dbase, FoxPro, Paradox and PFXplus.

The database drivers and wrapper DLLs should be in the \2.5\bin directory. However, they may not install with the typical CR 10 installation by default, in which case you need to enable additional Database Access Options to add the required crdb_p2b*.dll files during or after installation. On the other hand, if you installed CR with Crystal Enterprise, the wrapper DLLs installed by default.

Once you see various crdb_p2b*.dll files in the \2.5\bin directory, find the "Crystal Reports database driver for PC Database" bridge crdb_p2bbtrv.dll.

Make a copy of it and rename it to crdb_p2bpfx.dll.

Check that you have the correct crdb file, and open CR 10.

In Crystal Reports select to create a new report and Create New Connection. With PFXcrystal 5.1 and crdb_p2bpfx.dll all in place, the Database Expert now contains a Powerflex connection.

If you set up Crystal Reports to display *.dat files as the preferred file type and set a default data directory with *.dat files, clicking the plus sign to the left of the Powerflex connection will list all *.dat files in your chosen default data directory.

Create the report as required, and save it. Next time you wish to run the same report, you can open it simply from the Crystal Reports menu-File-Open. Alternatively, you can use the RUNPROGRAM command to open Crystal Reports directly from a PFXplus program.

Top of Page

Technical Tips


Technical tip No 46

Chris Peskett, SS&C Technologies, Inc., USA

PFXplus programs can use ENCRYPT statement to convert text into an encoded form for concealment.

ENCRYPT text [ WITH key ] TO var

Where text is a string value to be encrypted and key is an optional string value which acts as a seed to restart the encryption process.

The operation is symmetrical, that is using ENCRYPT on the output regenerates the input provided that the same seed is used.

Some text/key combinations will produce a space. If that space falls at the end of the string, storing the string in a data field becomes problematic, since you would not know how much blank space to decode. The solution is to wrap the encrypted string in brackets ([ ]), and then strip them off before making comparisons at the output.

STRING inline str key outline
                inline="XXXX"
                key="BRENDAN"

ENCRYPT inline WITH key TO outline
                outline ="([" + outline + "])"
                outline =MID(outline,(LENGTH(outline)-4),3)
ENCRYPT outline WITH key to str 

Technical tip No 47 - PADZERO Function

Warren Schaefer, iPROsoft Pty Ltd, Australia.

In our Ulaunch programs we generate the setcolumn statements based on the field type. For example

if iFType==1 sColDef=("PadZero(Field("-string(sFileNo)-","-
string(sFieldNo)-")," + string(iDecpl*2) +",true)") else sColDef=("@" +
string(sFileNo)+","+string(sFieldNo))

When we have numbers with no decimal places, the PadZero function returns the number with the decimal separator at the end of the number, "1,000.", and not "1,000" as we require.

To change this, add the following code directly before the END_FUNCTION of the PadZero function in LKUPSRCH.PFI.

if right(Result,1)==decpnt Result=left(Result,(length(Result)-1))
END_FUNCTION 

Technical tip No 48 - EditWithButton

Yu Qing Zhu, Powerflex Corporation Pty Ltd, Australia

PFXplus can create an EditWithButton control by defining an object using the class CCEditWithButton as defined in WCOMCTL.PFI. It must be associated with a standard edit control "___" and has a configurable button. This button is associated with a KEYPROC and is commonly used to invoke a lookup.

#USE KEYS.PFI
.
.
CCEditWithButton {wndw=s1_name, code=FK_USER} 

PFXplus default for KEY.USER (FK_USER) is F7. In many PFXplus sample programs, F7 is used to open the lookup associated with the button.

Microsoft applications, however, open a selected drop-down list with Alt+DownArrow, and so some users may prefer to use that key combination to open PFXplus lookups as well. The following code enables both, F7 and Alt+DownArrow, to invoke the lookup.

CCA_FormSubformBegin 1 Screen1
                CCEditWithButton {wndw=s1_COUNTRY,code=FK_USER}
                event (EVS_ALT + EVA_DOWN)
                keypoke KEY_PC_F7
                end_event
CCA_FormSubformEnd 

Top of Page

Powerflex News and Product Update


Pervasive 9 Support

PFXplus version 5.0 Service Pack 3 developer and end user runtimes have been validated for Pervasive PSQL v9. Previous versions of PFXplus may support Pervasive PSQL v9 set to file format 7 compatibility. PFXplus 5.0 SP3 also supports Pervasive v8 with format 8 files.

Running your applications with PFXplus Btrieve runtimes accessing Pervasive PSQL databases is great for businesses that want the power and speed of SQL without the cost!

PFXcrystal 5.1 released

Version 5.1 of PFXcrystal has been released. This release supports Crystal Reports versions 9 and 10. Check our website for update and pricing details. A special VAR members update price is available in the VAR members area of our website.

PFXplus or the Web

The final stages of beta testing of PFXplus for the Web is currently underway. Contact us if you want to try out the beta software (before it goes into production) to see what it can do for your applications and your business.

Contributors Welcome

We are continually impressed by the ingenuity of PFXplus Developers and their habit of coming up with innovative ways of solving problems using the many powerful features of our products.

Have you written a snappy piece of code or overcome a tricky issue using Powerflex products? Would you like to share it with other developers? Then why not write an article for POWERlines. Anything from short technical tips to multipage articles are always welcome.

So if you have something to contribute to the Powerflex development community, contact us and we will help you get your ideas into print.

Top of Page

Current Versions of Powerflex Release Software

PFXplus Developer's Kit 32-bit for Windows/Btrieve/SQL incl SP2 5.0
PFXplus Runtimes 32-bit for Windows/Btrieve/SQL incl SP2 5.0
Service Pack 3 for PFXplus Developer/Runtime/PFXodbc/PFXbrowse 32-bit for Windows/Btrieve/SQL 5.0
PFXplus for UnixWare incl SP2 5.0
PFXplus for Open Unix 5.0
PFXplus for AIX incl. SP2 5.0
PFXplus for SCO Unix 5.0
PFXplus for Linux SP1 5.0
PFX C-lib 32 bit for Windows/SQL incl SP2 5.0
PFX C-lib for Linux 4.41
PFX C-lib for SCO Unix 4.41
PFXsort for 32 bit Windows/SQL incl SP2 5.0
PFXsort for UnixWare 5.0
PFXsort for SCO Unix 4.41
PFXsort for Linux 4.41
PFXbrowse 32-bit Windows/Btrieve/SQL Developer version incl SP2 5.0
PFXbrowse 32-bit Windows/Btrieve/SQL End-user version incl SP2 5.0
PFXbrowse Developer for Linux 4.41
PFXbrowse Developer for SCO Unix 2.10
PFXodbc 32-bit for Windows incl SP2 5.0
PFXcrystal 32-bit for Windows SP2 5.0
PFXplus HTML Help 5.0

Top of Page