Hi,
I'm not aware of any method to achieve this directly using MVEL.
As an alternative it's possible to use the "Invoke-MySqlQuery" function with a custom WFA command. EG:
#'------------------------------------------------------------------------------
#'Create a query to select the least used aggregate in the resource pool.
#'------------------------------------------------------------------------------
[String]$query = "SELECT id AS 'aggregate_id', node_id, name AS 'aggregate_name', used_size_mb FROM cm_storage.aggregate WHERE id IN (SELECT aggregate_id FROM cm_storage.resource_pool_member WHERE resource_pool_id = (SELECT id FROM cm_storage.resource_pool WHERE name = '$ResourcePoolName')) ORDER BY used_size_mb ASC LIMIT 1;"
#'------------------------------------------------------------------------------
#'Query the least used aggregate in the resource pool.
#'------------------------------------------------------------------------------
Try{
[Array]$results = Invoke-MySqlQuery -Query $query -ErrorAction Stop
Get-WFALogger -Info -Message "Invoked SQL Query: ""$query"""
}Catch{
Get-WFALogger -Error -Message $("Failed invoking SQL query: ""$query"". Error " + $_.Exception.Message)
Throw "Failed invoking SQL query ""$query"""
}
#'------------------------------------------------------------------------------
#'Assign recordset variables.
#'------------------------------------------------------------------------------
ForEach($result In $results){
[Int]$aggregateID = $result.aggregate_id
[Int]$nodeID = $result.node_id
[String]$aggregateName = $result.aggregate_name
[Long]$usedSizeMB = $result.used_size_mb
}
You can then assign the value from the recordset as a return parameter using the "Add-WfaWorkflowParameter" function
Add-WfaWorkflowParameter -Name "AggregateName" -Value $aggregateName -AddAsReturnParameter $True
The return parameters will be available in other commands in your workflow using the "Get-WfaWorkflowParameter" function. EG
[String]$aggregateName = Get-WfaWorkflowParameter -Name "AggregateName"
Hope that helps
/matt
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.