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: Continue reading

August 1, 2009 Posted by | 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.

Continue reading

January 7, 2009 Posted by | Database | , , , , | 2 Comments

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.

Continue reading

January 1, 2009 Posted by | 2. Datawindows, Datawindow PowerScript, Powerscript | , , , , , , , , , , | 10 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.)

Continue reading

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

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

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

Continue reading

June 25, 2008 Posted by | Powerscript | , , , | 5 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:

Continue reading

May 26, 2008 Posted by | Powerscript | , , , , , , , , , , | Leave a comment

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.

Continue reading

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