[Tip] Finding associated objects in Servoy 4
by David Workman
Data Mosaic
The Eclipse platform brings powerful searching features to Servoy that we didn't have before. Here are a couple of examples.
1. Find all the objects a method is attached to
How many times have you created a new global method and wanted to use it in place of another global method throughout your solution except for a few instances? This involves finding all the objects that use the old global method. Have fun doing this in Servoy pre-4.0.
In Servoy 4, all methods have a UUID displayed prominently above the method:
[image unavailable: Picture_55]
Copy this UUID, open a new search from the navigation bar, and paste this string in:
[image unavailable: Picture_56]
Running the search will return in the search view pane a list of all the objects that contains this UUID neatly categorized by the containing objects:
[image unavailable: Picture_58]
It is quite easy to tell that on the form "CRM_0F_companies" the UUID string shows up in the form's javascript file and on four objects. Selecting those objects will verify that each one has the method we searched for attached to the "onAction()" event.
2. Find all the forms a form is attached to
It doesn't take long developing a solution in Servoy to create quite a collection of forms. Many of these forms will be included in other forms via tab panels. This leads to form re-usability which is a good thing. It can also lead to editing a form that you didn't realize was used in multiple situations -- which isn't always a good thing.
So before embarking on editing a form, maybe you want to find all the forms which use it. As it turns out, all objects in Servoy have a UUID including forms. It follows that if we use the same search steps used in the first example, the search will return a list of objects containing our form UUID.
The only trick: where is the form UUID? It is not prominently displayed in the "form design" perspective:
[image unavailable: Picture_59]
You need to open the "resource" perspective to find this information:
[image unavailable: Picture_63]
In the project explorer view pane of this perspective, you will see a folder and an object file for each of your forms. Open the object file for the form you want to search for and there you will find the form's UUID:
[image unavailable: Picture_60]
Now do a new search and you will get a search result pane with the results. The form I searched for shows up in two tab panels in two different forms:
[image unavailable: Picture_61]
Switching back to the form design perspective:
[image unavailable: Picture_62]
Summary
Using Eclipse's powerful search capabilities and Servoy UUID's, you can easily find associations between various objects in your solution.
Comments (2)