Having written my PowerBuilder code I may have several datawindows, one of which is called, let us say, d_Gubbins. Can I search through the whole uncompiled program to see if the datawindow is actually used or not please?
4 Answers
Download PBLPeeper and run the DataWindow Object Usage report. You can also run the Object Cross-Reference and take a look at the unreferenced objects. Beware of code like this:
public subroutine evil(string as_thing);
string ls_hidden = "d_muahahah_"
ls_hidden = ls_hidden + as_thing
dw_1.dataobject = ls_hidden
end subroutine
We've banned building names like this.

- 2,706
- 14
- 21
-
Thanks for the PBL Peeper reference. On the PP Browse page, you can also right click the DataWindow, Find / Elsewhere in the App to find all other references. Find page, with Whole Word Only, Case Insensitive, Include Quotes and Portion Type = All will also do it. But if the objective is going to become find *all* unreferenced objects, then the aforementioned Object Cross-Reference / Unreferenced Objects list is the easiest way to go (it'll just take a little more time up front). – Terry Apr 09 '14 at 14:41
-
1And thanks for the correct spelling of "muahahah". I'd always used a 'W' for some strange reason. – HugMyster Apr 11 '14 at 14:19
You may also find PB Tools useful for this. http://myelkovan.codeplex.com/

- 2,337
- 2
- 20
- 23
You can do a text search of your dataobject name :
- Right-click on the target (the green circle at level 2 of the project tree view - not the workspace on top level)
- Search...
- enter
d_Gubbins
in the text field, uncheck the match case option and check both of the "search in" options
If that dataobject is mentionned somewhere, it will be listed in the search results tab page. You might have some false positive results that mention OBJ:
these where the datawindow is listed in deployment targets, but it does not tell that the object is actually used. You can also have wrong results if you have some other objects with the same name radix, e.g. d_Gubbins_old
or d_Gubbins_temp_for_test
.

- 11,135
- 7
- 46
- 70
-
Appreciated Seki, but this is where the whole idea falls down. The datawindow itself may be called `d_Doodad` but all references are called, say, `dw_Doodad` (or `dw_OtherDoodad` if there are multiple on the screen). This is where the Search idea falls a little flat... – HugMyster Apr 11 '14 at 14:18
-
@HugMyster: I do not get it: your datawindow can be displayed by means of a *datawindow control* named `dw_foo` or `dw_whatever`, but you still can search where its *dataobject property* is set (either in some function/event, or in the default properties set at object construction) to `d_Gubbins` (provided that there is no dubious name construct like described by Hugh Brackett in its answer)? – Seki Apr 11 '14 at 14:50
-
I've always written the code such that the datawindow is defined as `d_datawindow`. When it is used by the code window, we will have a datawindow (called `dw_thingy` for example) which is set to use the window simply by declaring it in the properties (`name=**dw_thingy**, dataobject=**d_datawindow**`). However, it seems IMPOSSIBLE to find the specific datawindows (the d_ sidw) as they will never appear in the searches. – HugMyster Apr 14 '14 at 13:39
If you search with double quotes around the name it will find only proper references.

- 957
- 4
- 7