SQL Methods in Java Method in Activities:
In Activities, if we want to write some custom java functions or some java methods, we will be using Java Method.
Now we will see how to include custom SQL queries without RDB methods.
In Pega, in activity whatever the steps you are including, it will be converted to corresponding Java steps. For each and every method also it will be behave in the same way. similarly RDB Methods also will be converted to corresponding Java methods using inbuilt pega functionality.
In this approach, we will see how to call the Select Query in java method by using inbuilt java methods.
Sample SQL approach:
String StrSQL= "Select pzInskey as \"pzInsKey\",pyClass as \"pxObjclass\", pxUpdatedatetime as \"pxUpdateDatetime\"";
StrSQL += " from {class:Data-Rule-Summary} where rownum=1";
try{
tools.getDatabase(). executeRDB(strSQL, pg);
java.util.Iterator iterResults = pr.getProperty(".pxResults). iterator();
ClipboardPage resultPage = null;
while (iterResults.hasNext()){
ClipboardProperty resultProperty = (ClipboardProperty) iterResults.next();
resultPage = resultProperty.getPageValue();
}
tools.getDatabase().
java.util.Iterator iterResults = pr.getProperty(".pxResults).
ClipboardPage resultPage = null;
while (iterResults.hasNext()){
ClipboardProperty resultProperty = (ClipboardProperty)
resultPage = resultProperty.getPageValue();
}
} catch(DatabaseException dbEx){
oLog.error("Error while listing instances", dbEx);
}
oLog.error("Error while listing instances", dbEx);
}
Please let me know, if any correction is needed.
No comments:
Post a Comment