Code Samples

Small fragments of ABL code which illustrate some principle or technique


Introduction to the parameter object

I'm reading Martin Fowler's refactoring and will work out some of his methods (which also apply to building new software) in this blog. Read this to get some background info:

http://sourcemaking.com/refactoring/introduce-parameter-object
http://www.refactoring.com/catalog/introduceParameterObject.html
http://martinfowler.com/ap2/range.html

Below a simple daterangeparameter object, and therebelow a procedure using the daterange object.


GUI OpenEdge Password Meter

A password meter written in ABL.
It is database independent and uses the first connected database for the session.
By default it has 2 levels of strength that can be easily checked for and/or required: Strong Passwords and Xtra Strong Passwords
It checks for the following:
Required for strong passwords:
Length of 12 to 24 characters
Use of all 4 types of characters
Not the same as the previous 5 passwords
No personal names (first or last) and no company names or company acronym (hard-coded).

Required for Xtra strong passwords:
At least 2 upper case letters used


How to add a colored square in the titlebar through api

Sometimes it's neccessary to add a Caption in the titlebar to give extra information to the user of your application. The attached file does this, and makes sure the window got redrawn when windows triggers arive.
As you can see, many instances of msgblst32 are added on this window. The goal is to make it more the controlling window which always catches the events on the underlaying session applications. As every window needs its own ocx, I provided 40 instances which are hopefully enough to maintain every window.


Video on calling web services from the 4GL/ABL

I have a video up on amduus.com on how to call out to web services with example coding.

The video can be seen at http://amduus.com/training/Using_bprowsdldoc.html


Example function to return various date formats. YYYYMMDD

In this example function you pass to it the format you want YYYYMMDD YYMMDD ISO etc. along with date and time delimiters you wish to use. This does use the NOW statement which is not in older versions.


Testing character values to see if they are integer, decimal or character values.

This set of examples show various methods to test for character, integer, and decimal values.
The various test methods came from a discussion on the PEG and suggestions by members and myself.

Typical time results per 100,000 iterations of the functions.

+--------------------------------------------------+
¦-123                                              ¦
¦                                                  ¦
¦fn-ISCHAR-loop:   31510 ms no  Loop method        ¦
¦fn-ISCHAR:         3681 ms no  DEC(x) error method¦

Una rutina para escribir con letras una cantidad, hasta 999,999,999,999.99

Here is this routine to translate a qty to string, it is spanish, right now, but I guess that is easy to translate to other idioms, in fact, I would like to know if you translate this to other languages.


No-focus bug vs feature

Prior to OpenEdge 10.1, when you click a no-focus, flat button in a window the window does not get focus. It's z-order among other windows is unchanged.

In 10.1A this feature (Progress calls it a bug) is fixed. Clicking a no-focus button now sets the focus to the window containing the button.

I'm looking for a way to get the old behaviour back.


How create an INSTALLER to my Progress Programs?

Hi:
I developed a Payroll System in Progress Version 9.1E and I want to you tell me that way I can create an Installer or what program I can use to install my Payroll System in others computers.

The PCs where it is needed install the Payroll System have the next characteristics:
- Windows XP Professional and Windows 2000

I hope any solutions, thanks.


Syndicate content