SRP Tech Bites v2

As a provider of two framework products for OpenInsight, we recommend our customers create a dedicated application (e.g., FRAMEWORKS) to maintain the original framework entities. Then the business (or commercial product) application should be created to inherit from this application rather than directly from the Default Inheritance (i.e., SYSPROG). This is easy enough when the local application has not yet been created. However, there are times when the child application already exists. This brings up the question, “Is there an easier way to change an application’s parent without having to back up the local app, delete it, and then recreate it with new inheritance?” Indeed there is.

The subject matter was originally among our list of topics for our next SRP Tech Bites article. However, one of our colleagues recently ran into this situation when installing the SRP HTTP Framework and reached out for assistance. Thus we decided to publish this article a little early with a focus on the mechanical details. It should be noted that while this is largely undocumented information, the basic solution has been posted in the discussion forums (cf. this 2003 thread if you have a WORKS subscription). Like so many other golden nuggets that are still buried in the depths of the forums, it is worthwhile to excavate these from time to time to help broaden community awareness.

The simple technique presented below relies on two system stored procedures which interact with the SYSAPPS table:

  • Get_App_Info – Returns an @FM delimited list of application specific information. The REPOSITORY_EQUATES insert defines constants that will help identify the meaning of each data element. This function is also documented in the OpenInsight 10 Programmer’s Reference Guide.
  • Add_Repos_App – Creates or updates an application.

Since the data stored in the SYSAPPS table is encrypted, it is necessary to employ these routines to view and update the application metadata. The general approach is to get the metadata using the Get_App_Info function, change the relevant information in the variable, and then use the Add_Repos_App subroutine to update the application. For demonstration purposes, we will replace the EXAMPLES application template app (i.e., SYSPROG) with an application named FRAMEWORKS. To visualize the change, here is what the Application Properties dialog for the EXAMPLES application looks like normally:

Here is a code snippet that changes the template app:

$insert REPOSITORY_EQUATES

Declare function Get_App_Info
Declare subroutine Add_Repos_App

ChildApp                          = 'EXAMPLES'
ParentApp                         = 'FRAMEWORKS'
AppInfo                           = Get_App_Info(ChildApp)
AppInfo< SYSAPPS_TEMPLATE_APP$ >  = ParentApp
Add_Repos_App(ChildApp, AppInfo, 0)

After running the code, the Application Properties dialog now looks like this:

Yes, it really is that simple! It should be noted, however, that the OpenInsight forms might need to be recompiled. This is because forms include the resolved starting point for applicable event handlers. Therefore, any event handlers stored in the new middle-tier application might get overlooked if the forms in the child app use system event handlers as the starting point. Recompiling the form will resolve potential issues…assuming this is even a concern.

One Response to SRP Tech Bites v2

Leave a Reply