Schultz’s PowerBuilder Notes

Getting a Reference to a Submenu

Getting a reference to the window’s menu is easily accomplished using the window’s MenuId property.  But what if you want to get a reference to a submenu and all you have is a string with the menu’s name?  This following function will do the trick: Read more »

August 1, 2009 Posted by rick130 | 1. PowerBuilder General, Menus, Powerscript | , , | 1 Comment

Sybase and Nulls

If you have not read about how PowerBuilder treats nulls, you may want to read  nulls first.

Read more »

January 7, 2009 Posted by rick130 | Database | , , , , | 1 Comment

Setting the RowStatus

If you have worked with PowerBuilder for a while, you have learned that setting the status of a row is not always a straight forward procedure.  I have created a handy utility which will simplify this process.

Read more »

January 1, 2009 Posted by rick130 | 2. Datawindows, Datawindow PowerScript, Powerscript | , , , , , , , , , , | 4 Comments

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.)

Read more »

September 19, 2008 Posted by rick130 | Database, Powerscript | , , , , | No Comments Yet

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?

Read more »

August 14, 2008 Posted by rick130 | Powerscript | , , , | 1 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.

Read more »

July 14, 2008 Posted by rick130 | 1. PowerBuilder General | , , , , , | No Comments Yet

Negative Logic

I maintain several PowerBuilder applications which were written a long time ago by developers just starting out in PB. So I see a lot of odd code.

Here is an example of a script which has negative logic

Read more »

June 25, 2008 Posted by rick130 | Powerscript | , , , | 2 Comments

System Functions

Evaluate( )

The evaluate( ) function is available for use with Describe( ). Evaluate( ) lets you evaluate DataWindow expressions within a script using data in the DataWindow. It has the following syntax:

Read more »

May 26, 2008 Posted by rick130 | Powerscript | , , , , , , , , , , | No Comments Yet

Dynamically Changing DataWindow Properties

What is the difference between SELECT and PBSELECT

PBSELECT is generic database independent SQL which is stored in the DataWindow. The actual outer join SQL for native Sybase connection will differ from an ODBC Sybase connection.

Read more »

May 25, 2008 Posted by rick130 | Datawindow PowerScript, Powerscript | , , , , , , , | 1 Comment