Searching PowerBuilder

It is amazing to me that as of version 10.5, Sybase still hasn’t added the ability to search for an object within your application’s libraries. My application has 69 libraries and over 2200 objects, so a manual search is really painful. I’ve brought this issue up with my very expensive support agents, and the answer has always been, ‘There are third-party apps to do that.’

I got so frustrated I even went looking for some of these apps. The best I could find was TechoKitten’s PBL Peeper. It did what I needed, but required more steps than I wanted to take to use on a regular basis. PBSearch looks promising, but provides more functionality than I need. Plus, it’s not free.

So, even though I shouldn’t have to, as much as it galled me that Sybase won’t provide this most basic IDE functionality, I made my own routine to write out the contents of the libraries.

public function of_listLibraries (string as_filepath)

You pass in the path to the file to which you want the library contents written. That’s it.

I call this in the open event of my application. I can’t see that it adds any time at all to the startup. It’s very fast.

Example call:

if of_inIDE() then
    n_cst_pb lnv_pb

    lnv_pb.of_listLibraries( 'E:\cygwin\home\david\pbappcontents.txt' )
end if

The output looks like:

someLibrary.pbl: n_cst_someobject
someLibrary.pbl: n_cst_anotherobject

anotherLibrary.pbl: n_cst_joesobject
anotherLibrary.pbl: n_cst_fredsobject
anotherLibrary.pbl: n_cst_billsobject

This is very efficiently searched using grep. I write my output to the home directory of my cygwin installation. This way I have the library contents and the grep tool in the same place. There are versions of grep for Windows if you don’t want all the unix utilities and functionality cygwin offers.

Here’s the shell shortcut I use for my application search (as):

as: aliased to cat ~/pbappcontents.txt | grep -i $*

Then, at the shell prompt (in cygwin), I can do:

> as name

nfcdwsrv.pbl: n_cst_dwsrv_fullname
nfcstub.pbl: nfc_n_cst_name
nfcstub.pbl: str_name
client_d.pbl: pl_ll_names_syb2ora
client_d.pbl: pl_ll_names_ora2syb

and get back the locations of all the objects containing the word ‘name.’ Very simple.

The only thing cooler would be Sybase building this search capability directly into the IDE. Or allowing us to add it via a customization interface.

Source Code
listlibraries.txt

Advertisements
Published in: on November 19, 2007 at 9:21 pm  Comments (3)  

The URI to TrackBack this entry is: https://dmcmeans.wordpress.com/2007/11/19/searching-powerbuilder/trackback/

RSS feed for comments on this post.

3 CommentsLeave a comment

  1. Not that I don’t think you’ve created a tool that fits your need nicely, do you mind if I ask what the difficult part of PBL Peeper is? I always appreciate a fresh perspective.

  2. Could be that I’m not using PBL Peeper correctly, but when I start it, I have to browse to the folder containing my libraries, drop that folder onto the right pane to display all the libraries, and then I can do a search. The next time I need to search for an object, I have to repeat the process including browsing for my libraries. This is what I meant by “too difficult to use on a regular basis.” It requires too many keystrokes. Perhaps I’ve missed something, but I expected PBL Peeper to remember the libraries I had from the last session. Then, a search could be invoked immediately.

  3. If you’ve got PB installed, there should be a tree branch that has applications from pb.ini or the registry listed in it (one branch for each version of PB or derivative product, like PocketBuilder). Digging through the file system folders shouldn’t be necessary, but you can do it if it’s an app that’s never been opened in PB, or if you want to select all apps in a subtree or drive.

    Still, if you’re looking for an object in the app you’re currently working on, with the default installation options, there should be a shortcut on your desktop that automagically loads that app (the “Current” app) and switches you to the Browse page. Launching QuickFind will start searching for an object by substring, prefix string or exact match, jumping you to the closest match whenever you stop typing. When you jump there, the PBL/object name should be in the microhelp, but the Up toolbar item will also jump you back to the PBL in the tree. If you don’t want PBL Peeper guessing at which app you want to look at, you can create your own shortcuts with command line parameters for the apps you regularly work on.

    So, to find an object, it should be double-click, Ctrl-Q, start typing the name (or, if you’re already in PP, Browse icon, Ctrl-Q, start typing).

    Then again, PBL Peeper is big, bloated, slow and it’s mother cuts its hair with a bowl. I’ve got no doubt there are more elegant solutions out there.

    Last selected is a good idea (that was the *idea* behind “Current”, but not quite the same), although I’d probably make that a command line parameter rather than a default. (I try not to launch into processing without user confirmation.) The challenge is that you can drag over a workspace with 3 apps in it, each with 69 PBLs, delete 14 PBLs at random, and then launch. I’ll have to figure out where to store all that information, keeping Vista-friendliness in mind (meaning not in PBL Peeper’s own program folder). Needs more thought. It’s probably two episodes of “Chuck” and a “Heroes” away from being solved.

    Thanks for the input.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: