Assembly
Workbench - Seek and Ye Shall Find
Problem
You are studiously working away on a
sparkling new application, when all of a sudden you receive, via
e-mail, the horrific news from the endearing team leader that one of
the features of the application requires rework. Looking at the
number of forms in the system, you’re heart skips a beat or two
before you dissolve into a dead faint. How are going to find out
which forms are affected? Plough tediously through millions of lines
of .PRO listings?
Solution
No! Fortunately, there is a way round
this. Hidden in the murky depths of the Assembly Workbench is a
component Find function. For the purposes of this discussion we’ll
use the DBS CV application to demonstrate the Find function, and how
to save you many hours of aching legwork.
The Find Component tool bares a
striking resemblance to Screenshot 1. It is accessed by clicking on
the cute magnifying glass icon, which you can spot as the fifth icon
along under the Assemble Components window. For each Search
mechanism, you need to Find What you are after, and select the
Subsystem, where (All) is as flexible as it comes. Life is never
simple, so let’s investigate this phenomenon in more detail.
Screenshot 1
The Keywords option is a rather useful
mechanism for searching Component Signatures for one or more
keywords, since each signature can be associated with one or more
keywords (in the Define Signature screen). For the purposes of this
demonstration, we will first of all find the names of all the data
lookup forms. The form signatures have been previously labelled with
the keyword "LOOKUP".
- Enter the keyword, LOOKUP, in Find
What, or select it from the Browse Keyword popup list of
available keywords.
- Check the Keywords option in Search.
- Select (All) as the Subsystem. This
is the default.
- Click on Find.
Screenshot 2 shows what happens. In the
Access Points window, the results of the find are shown, under the
tree structure Hits found for "Lookup". Each node
represents a component whose signature contains the matching
keyword. A further function, List Find Results under the Component
menu, gives further information about the location of the matching
keyword within the highlighted node. An example of this window is
shown in Screenshot 3. In this first example, the component DBS_LU01
has been highlighted. Listing the results for this component
produces little further information, other than ‘Found LOOKUP for
keywords of DBS_LU01’. DBS_LU01 was spotted because the two
keywords LOOKUP and CV have been defined in the Keywords property of
its signature definition.
Screenshot 2
That’s the simple stuff explained, so
let’s get a bit more clever. The second option in the Find
Component window (see Screenshot 1) is Proc in Triggers, with an
associated choice to Include Model and Template Triggers. As its
name suggests, this option searches through all component triggers
to match the specified text you have typed in the Find What box.
Note that keywords do not apply for this option, that the search is
not case-sensitive, and also that the search will match the text
whether or not it comprises a whole word; for example, a find on the
text "level_code" will match both the line "level_code
= $1" and "call aio_level_code".
For the next example, we’ll do a Proc
In Triggers search for the text "level_code", but leaving
out the Include Model and Template Triggers option. After entering
the text in the Find What box and clicking on Find, the results are
presented as shown in Screenshot 3. The View Find Hits window,
mentioned in the first example, describes in detail where each
occurrence of the level_code value text has been found. In this
example, the form component DBS_LU03 is guilty of containing several
references to level_code. Using the Edit Component or Edit Trigger
options (the two buttons next to the magnifying glass in the
Assemble Components window), you can then directly enter and
maintain the code in the highlighted component. Leaving the
component returns you to this screen, thus providing a neat way of
making boring and monotonous changes that little bit more fun.
Screenshot 3
In Screenshot 4, the Execute trigger of
DBS_LU03 is displayed, showing the two instances of level_code that
the find function reported for this trigger in Screenshot 3. In
addition, the Tags window (beneath the Structure window) displays a
Workbench Find Tags tree of all the triggers containing the matching
instances of the find request in this component, in this example
DBS_LU03. This tree structure can be used to directly access these
triggers, in the same way the Triggers window is used to edit
triggers.
Screenshot 4
The number of finds increases if you
select the Include Models and Templates option, since this extends
the search to look at the proc code in triggers at model and
template level. The results are displayed in the same View Find Hits
window together with those matches at component trigger level. There
is no marked differentiation between matches found at component
trigger level and those found at model or template level.
The third find option, Descriptive and
Comment Fields, does a search on the ‘Description’’ and ‘Comments’
fields in each Component Signature. Any matches found are displayed
as for previous searches. For example, a search for the initials
"CHL" lists several hits, including DBS_LU03. The message
‘Found "CHL" in description of DBS_LU03’ is displayed
in the View Find Hits window.
This find option can also be extended
to search the ‘Description’ and ‘Comment’ fields of the
Component, by selecting both the Proc In Triggers and Descriptive
and Comment Fields options. The search looks in the Component
Signature ‘Description’ and ‘Comment’ fields, the Component
‘Description’ and ‘Comment’ fields, and the Component
triggers.
For example, the text "CHL"
exists in the Component Signature ‘Comments’ field and in the
Component’s ‘Comment’ field for DBS_LU03. Running a search for
"CHL" with only the Descriptive and Comment Fields option
selected will only search the Component Signature. However,
extending the search to include the Proc In Triggers option will
also find the text in the Component Comments field. Note that the
View Find Hits window displays the text line ‘Found
"CHL" in description of DBS_LU03’ twice, since it does
not make any differentiation between the Component Signature and the
Component itself.
A further feature of the Find Component
facility is the Keep Existing Find Tags option. As its name
suggests, selecting this option prevents the Access Points current
‘Hits’ from being cleared down before the new search is done.
This allows you to perform more than one search and still retain the
lists from previous searches. As each search is done, the View Find
Hits window expands to include the current component’s find hits
from previous searches.
For example, performing a search for
"CHL" finds the text in the description of DBS_LU03.
Performing a new search for "level_code", whilst retaining
the Keep Existing Tags option, creates a new hitlist, this time for
level_code. DBS_LU03 is included is this hitlist, as shown in
Screenshot 5, and looking at the View Find Hits window for DBS_LU03
in this list shows both the find results from the first search (for
"CHL") and this search.
Screenshot 5
A final tip. It is possible to perform
a search for multiple values, by using the
<GOLD><semi-colon> key combination in the Find What box
to separate each of the required values. Note that the search is
done on a ‘list the component if it contains any of these values’
basis, rather than ‘contains all of these values’. Values can
comprise any combination of text and keywords. The matching hitlist
is displayed as normal in the Access Points window with, for
example, the title ‘Hits found for "CHL" and
"level_code" and "LOOKUP"’.
And finally... It is also worth
pointing out that UNIFACE gets very confused if you insert more than
one <GOLD><semi-colon> after a specified value, since
UNIFACE fails to understand the following value, and therefore will
not search for it. This is most likely to happen if you use the
Browse Keyword popup to include keywords at the end of your Find
What list. For example, "CHL" and "level_code"
are specified in the Find What box, separated by a
<GOLD><semi-colon>. If you then use the Browse Keyword
popup to add the "LOOKUP" keyword to the find criteria,
UNIFACE always inserts a <GOLD><semi-colon> before the
keyword text. Even if you have already placed a
<GOLD><semi-colon> after "level_code" in
anticipation of knowing you’ll be adding this further value,
UNIFACE will still insert another before the keyword.
That’s it. You’ve sought, and now
you’ve found.
|