Defining a Post Query

The post query script lets you manipulate the data after it is fetched from the database. You must write the post query script in the Java programming language.

In order to use a post query, you must ensure that you select the Call Post Query checkbox while defining the data source details.

  • To define a post query, open the </>Post Query tab. The query editor is displayed. You can define your post query here as per the requirement.

You can call the predefined post query methods directly from the editor. On entering db. in the text editor, the list of methods is displayed. You can click on the required method from this list.

Examples

  1. If you add the following post query to your datasource, on refreshing the data, the user will not able to view the time component in the start date. However, in the database, the start date will store the time component.

Date startDate =   data.get("startDate");
data.set("startDate",dateUtils.clearTime(startDate));

Another example

Object fileName = db.evaluateSeIectSQL("select File_name from RA_FILES WHERE FILE_ID = "+data.get("attachmentId") + "AND FILE_REVISION = 1");

Object fileSize = db.evaluateSelectSQL("seIect File_size from RA_FILES WHERE FILE_ID = "+ data.get("attachmentId") + " AND FILE_REVISION = 1");

if (fileName ! = null && fileName.trim().lastIndexOf(".") ! = -1) {
data.set("filetype", fileName.substring(fileName.trim().lastlndexOf(".")));
}

if (data.get("parentdocument") != null ) {
Object parentDocName = db.evaluatese1ectSQL("se1ect DOC_NAME from DMS_DOCUMENT_DATA WHERE DOC_ID =" + data.get("parentDocument"));
data.set("parentDocumentName", parentDocName);
}

Last updated