Schultz’s PowerBuilder Notes

Guaranteeing a Singleton


Because the datetime on the client machine may not be accurate, I wanted to write a function to get the current date and time from the server.  

For Sybase DBMS, this is simply achieved with the GetDate() function.  The problem is developing the SQL to return exactly one row everytime the function is called.  (It will still work if the SQL returns multiple rows, but you will have a lot of unecessary database traffic.)

Continue reading

Advertisements

September 19, 2008 Posted by | Database, Powerscript | , , , , | Leave a comment

Nulls


I find nulls to be the cause of so many bugs. Here are a few things that have helped me get my mind around this surprisingly confusing topic.

Let’s look at the following script, what would the result be?

Continue reading

August 14, 2008 Posted by | Powerscript | , , , | 2 Comments

Adding PFC Help to the PowerBuilder Menu


  • In the development environment, right click on the menu and select “Customize”
  • Click on the Custom radio button
  • Drag a new icon to the spot on the menu
  • A modal window pops up:
    • Command line should have the following text: (note the location of the PFC help file on your PC may be different)

winhlp32.exe C:\Program Files\Sybase\PB6\pbpfc60.hlp

or

winhlp32.exe  C:\Program Files\Sybase\PowerBuilder 7.0\Help\pbpfc70.hlp

  • Add Item Text
  • Add Item Microhelp

July 21, 2008 Posted by | 3. PFC, Utility Services | | Leave a comment

PFC Security Q and A


How do I enable the PFC security service?

A common place to do this the pfc_postopen event of w_frame

gnv_app.of_SetSecurity(True) //Enable security service

How do I force security to run on a particular object

Continue reading

July 21, 2008 Posted by | 3. PFC, Utility Services | , , , , | Leave a comment

PFC Security


PFC Security can restrict access to

  • Menu items
  • Graphic objects
  • DataWindow columns

Each object may be enabled/disabled or made invisible

Continue reading

July 21, 2008 Posted by | 3. PFC, Utility Services | 1 Comment

PFC DateTime Service (n_cst_datetime)


The Date/Time service provides methods to perform calculations with dates.
It includes the following features:

Continue reading

July 16, 2008 Posted by | 3. PFC, Utility Services | , , , , , , , , , , | Leave a comment

Changing an Object’s Ancestor


I was once in a code review and I noted that the custom object that was built should be inherited from n_base so it can inherit the constants SUCCESS, FAILURE and NO_ACTION.

Continue reading

July 14, 2008 Posted by | 1. PowerBuilder General | , , , , , | Leave a comment

PFC String Service (n_cst_string)


The string service provides support for manipulation of strings.
It includes the following features:
Continue reading

July 11, 2008 Posted by | 3. PFC, Utility Services | , , , , | Leave a comment

Working with PFC INI Files


Reading from the User INI file

// get list of CSR emp ids from INI file and select these
ls_usr_ini = gnv_app.of_GetUserIniFile( )
ls_csr_string = ProfileString(ls_usr_ini, "CSR", "EMP_ID", "")

Continue reading

July 10, 2008 Posted by | 3. PFC, Application Services | , , , | Leave a comment