PS Query | Checking to see which records and fields have been used
A. Find Definition References
If you’re considering making a change to an existing record or field in App Designer, you would start by carrying out an impact analysis to see what other objects would be affected by the change. One common means to do this is via the ‘Find Definition References’ functionality in App Designer. For the currently open object, the system will check to see how the object has been used elsewhere in the system. You can then make a decision as to whether the proposed change is safe to make, or whether further changes are required.
Although the search results for ‘Find Definition References’ include PS Queries, it can be quite a chore to work your way through this list, especially if you have a lot of objects in your search results, or you need to check a lot of source objects. ‘Find Definition References’ only works with one object at a time.
B. Query Analysis using SQL
As an alternative, the following SQL select can show you all PS Queries that reference a particular record:
select a.oprid, a.qryname from psqryrecord where recname = 'PERSONAL_PHONE';
This can be expanded to all queries that reference ANY record included in a project:
select a.oprid, a.qryname from psqryrecord a, psprojectitem b where a.recname = b.objectvalue1 and b.objecttype = 0 and b.projectname = 'PROJECT_NAME';
Finally, here are the two equivalent statements for fields:
select a.oprid, a.qryname from psqryfield a where a.fieldname = 'BIRTHDATE';
select a.oprid, a.qryname from psqryfield a, psprojectitem b where a.fieldname = b.objectvalue1 and b.objecttype = 2 and b.projectname = 'PROJECT_NAME';