I'd like to know which are the tables/Classes used for storing the source code for the activity rules. In fact I'd like to implement a new report/activity that allows to export (in excel) the activity's code as well we see it in the Designer Studio.
I've seen that the table could be "PR4_RULE" but I'm not able to find the class. Am I on the right way?
Anyway, I'd like to export the HTML page (regarding the activity's code) in excel, I'm trying to use a chrome extesion to get the text like "Data Miner" or "Web scraper" but they don't work with the Pega web page (they don't support the forms and frames).
thanks for the answer, but I'd like to have the code as well it is written in Designer studio and not in Java.
In fact I'd like to export the HTML page (regarding the activity's code) in excel, I'm trying to use a chrome extesion to get the text like "Data Miner" or "Web scraper" but they don't work with the Pega web page (they don't support the forms and frames).
this activity calls the Java method "pega.getGeneratedJavaSourceCode(className)" that returns the Java source code. I'd like to have instead the source code as displayed in Designer Studio (Pega code and instructions).
Rule Definitions are stored as XML; so you would need to parse this XML in a way to render to EXCEL.*
To view the XML of a particular rule from the Designer Studio - open up the Rule (say 'HTMLTOPDF') - and then click on 'Actions | View XML'.
This will show the definition of the Activity Rule.
If you want to do this programmatically , you can create another PRPC Activity to perform an 'Obj-Open' on the rule.
First you'll need to know the 'keys' for the Rule Type; to do this - choose your class (in this case it is 'Rule-Obj-Activity'); put this in your Rule Explorer in Designer Studio, and then right click the leaf node and choose 'Definition':
This will bring up the Rule Form for the class, which will identify the keys, in this case
You can now use this in an 'Obj-Open' to get at the XML of the Activity of your choice.
(Actually: it turns out you actually get slightly different XML when compared with the 'View XML' method; I *assume* that this is because 'Obj-Open' is also 'Rule-Resolving' (with respect to 'Rulesets' ; which we are not specifying here) but the 'View XML' is opening up an exact instance - but I'm not sure on that).
Here's an Activity that retrieves the XML for the Activity '@baseclass.HTMLTOPDF' for instance:
Now comes the difficult bit:
You need to reverse engineer the Page Data here that defines the Activity; some of it is self evident, most of it is not. For instance you can locate the 'History | Description' text in the pyDescription property:
Change the Activity Above; comment out the 'Show-Page' step and instead put in a 'Show-Property' Step like this:
And you'll get the description of the Activity out instead.
You could probably pull apart this structure using a series of 'Data Transforms'; and rebuild your own model which represents the output you need for your Excel File; but it will probably take quite a bit of experimentation.
I tried something similar a while back: but I wanted to output the Activity as a standalone 'HTML' file; I got so far but then got stuck. I went for a different approach - I got the XML outside of PRPC and then applied an XSLT stylesheet to reformat the XML; I'll share that here for what its worth - you might be to use to , to get some of the structure (which I reverse-engineered - so I could have got it wrong) of the Page.
Here's what the output looks like - its actually using JQuery to provide tabs etc - but this is incomplete I'm afraid. (not all step-types can be expanded).
If you want to try this approach; you'll need an XSLT processor (actually PRPC has a mechanism to do this also) like Saxon.
The attachment is actually a 'ZIP' file ,but we are not allowed to upload ZIPs here; so I renamed the extension to 'TXT'.
[*EDIT: Rule Definitions are actually stored in the Pega Model ; that is as 'Pages' of data; so you don't have to work at the XML level; you can work 'within the model' here - using Data Transforms, Activities etc;I meant that the Page Data is de-serialized into XML really. ]
And to answer you original query about 'what tables are used to store the rules' - although the data is available in PRPC tables; it is best to access them it at the PRPC Class Level : since data is (at least partially) stored in BLOB fields; and cannot be easily extracted from SQL tools etc.
Using Pega 'Obj-Open' (etc) methods abstracts this detail away ; properties just appear as properties - there is no need to know whether they are in 'exposed' columns or 'blobs'.