Saturday, August 15, 2020

Should I Enable Run On Data Page Option? [DBTalk Series]

[I am starting a Debunkum Beaver Talk Series (DBTalk). This would be some kind of ad-hoc posting whenever something comes to my mind or there are something that I would like to highlight and share. This would be a more frequent posting, rather than creating books, which would typically take a much longer time.]

For this first post of the DBTalk Series, I will touch on the Run on data page” option in the Datapage rule, as shown below:

 

Figure 119: "Run on data page" Option

This is actually a chapter in the "Creating REST Service and REST Connector: How-to Guide", but would be a valuable knowledge for other Pega developers too.

The general recommendation is to enable it if your datapage’s “Object type” is the same as the output class of your “Response Data Transform, which in most of the situation it is the same. In short, you should be enabling it most of the time.

Once enabled, this executes the response data transform directly on the data page rather than on the Data Source page, saving the memory and processing cost of an unnecessary page and mappings. However, there are a few things you need to take note of.


1) Generated Response Data Transform

 When the “Run on data page” is not ticked, the generated response data transform would have the following line:


Figure 121: Generated Data Transform (“Run on data page” Unticked)

On the other hand, when the “Run on data page” is ticked, the generated response data transform is as follows:


Figure 122: Generated Data Transform (“Run on data page” Ticked)

The difference is not just the generated code, but also how you do the mapping logic. Without ticking the “Run on data page”, you need to map all your data from the “DataSource” Page.


 2) Differences in the Datapage Output

 Apart from the above, note that there are also some differences in the output of the Datapage. The following diagram shows the differences.

 

Figure 124: Datapage Executed Without The “Run on data page” Option

 


Figure 125: Datapage Executed With The “Run on data page” Option

Notice that when the “Run on data page” is ticked, we have the “MyRequest” page (which we had set earlier) appearing too. Of more interest are the additional fields: “pyHTTPResponseCode”, “pyStatusMessage” and “pyStatusValue”.

 [You can check out the "Creating REST Service and REST Connector: How-to Guide" [Master Beaver Version] to learn the step-by-step context of the above]