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.getProperty("Number")); System.log(resultRecords.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.