You are currently browsing the Programming category

PowerBuilder – Setting column value without looping through all rows.

Posted on March 3, 2011 at 8:00 pm in

A question came up on the TekTips website about setting a column in all the rows in a datawindow to the same value without looping through. In this case the writer was loading data from over one hundred Excel files and wanted to track the filename of where the data came from. At first I…

PowerBuilder – Setting column value without looping through all rows. - the full story »

PowerBuilder – Development vs. Production Mode

Posted on February 22, 2011 at 8:20 pm in

You can set up a variety of helpful methods for use while developing an application which you don’t want users to get their hands on when in production. One example of this is my Window Information Service . To make this only available when running from the Powerbuilder IDE use the following steps. Set up…

PowerBuilder – Development vs. Production Mode - the full story »

PowerBuilder – PFC String service extension

Posted on February 21, 2011 at 8:20 pm in

Here is a simple modification to the PFC string service (n_cst_string) which will parse out an array of any datatype and returned a delimited string of the contents. The new method is a polymorph of the existing of_arraytostring. public function long of_arraytostring (any aa_array[], string as_delimiter, ref string as_string) // convert array to string array…

PowerBuilder – PFC String service extension - the full story »

Sequence Numbers in SQL

Posted on February 7, 2011 at 8:20 pm in

Here is a link to a very good article on SQLServerCentral.com showing a technique to re-sequence items via a database stored procedure rather than on the client. It’s pretty straight forward and solves a fairly common issue I’ve addressed several times in PowerBuilder over the years.

Sequence Numbers in SQL - the full story »

Update Columns in Database

Posted on January 28, 2011 at 8:20 pm in

It’s pretty common to want to update a column (or several columns) in one table with the value(s) from another table. Here is how to do it: UPDATE Table SET Table.col1 = other_table.col1, Table.col2 = other_table.col2 FROM Table INNER JOIN other_table ON Table.id = other_table.id WHERE … The structure of this syntax is always something…

Update Columns in Database - the full story »

PowerBuilder – Add /Remove a Font at Runtime

Posted on January 12, 2011 at 8:20 pm in

Here is a way to add (and remove) a font to the user’s machine at runtime. You can also use this to check if a user has a particular font installed since the code also shows how to list all the installed fonts (need MS Word for this). Way back in my PB5 days I…

PowerBuilder – Add /Remove a Font at Runtime - the full story »

PowerBuilder – Next Key Service

Posted on January 11, 2011 at 8:20 pm in

As an extension of the next key stored procedure article, here is a pretty easy to implement a next surrogate key service to use with the PFC. If you don’t use the PFC it is still fairly easy to use with some modification. You can use this service anytime you want to get a sequential…

PowerBuilder – Next Key Service - the full story »

PowerBuilder – Move Frequently Chosen Items to Top of DropDownDataWindow

Posted on January 7, 2011 at 8:20 pm in

I’m looking at an application which basically records demographic information for a population. One of the fields listed is ‘primary language’ which has a typical dropdowndatawindow interface. I look at the options and BAM!, a huge alphabetical list (including Esperanto!). Now this application is generally used in the US so my guess is at least…

PowerBuilder – Move Frequently Chosen Items to Top of DropDownDataWindow - the full story »

Next Key Service for Database tables

Posted on December 30, 2010 at 8:20 pm in

This provides for an easy way to generate key values for tables in a database when you don’t want to use a system generated value (like an IDENTITY column). The example is for MS SQLServer 2000 but could be adapted to any database which supports stored procedures. Note that this service assumes the key value…

Next Key Service for Database tables - the full story »

PowerBuilder – Locating Windows folders

Posted on December 29, 2010 at 8:20 pm in

Here is an easy way to find the paths to the various Windows folders. oleobject lole_wshell lole_wshell = create oleobject lole_wshell.connecttonewobject( "wscript.shell") is_mydocspath = lole_wshell.SpecialFolders("MyDocuments") IF IsValid(lole_wshell) THEN Destroy lole_wshell /* other folders: AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUsersStartup Desktop Favorites Fonts MyDocuments NetHood PrintHood Programs Recent SendTo StartMenu Startup Templates */

PowerBuilder – Locating Windows folders - the full story »

Top