Orchestrator · SQL

vRO Read a custom query from a database

If you want to retrieve some information from database, you can run a workflow which is provided with default vRO plugin. The name of the workflow is “Read a custom query from a database”

System.log("Executing query " + query + " on database " + database.name );
resultRecords = database.readCustomQuery(query);

System.log(resultRecords[0].getProperty("Number"));
System.log(resultRecords[0].getFieldNames());

First two lines of the code are taken from the default workflow.

“resultRecords” is the variable which is used to provide the output of the query.

Since it is providing array of SQL:activerecords, you need to access the array and then use .getProperty(“string”) and .getFieldNames() methods.

getFieldNames() will provide you Column name of query’s result.

.getProperty(“string”) will provide you the string value of the query output. In this case “Number” is the column name.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s