<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Access WFA database from command fields using MVEL or access WFA database from a WFA Function in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119725#M21414</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help us know the exact reason for this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Akash Shukla&lt;/P&gt;&lt;P&gt;TME&lt;BR /&gt;WFA&lt;/P&gt;</description>
    <pubDate>Mon, 30 May 2016 07:02:28 GMT</pubDate>
    <dc:creator>AkashShukla</dc:creator>
    <dc:date>2016-05-30T07:02:28Z</dc:date>
    <item>
      <title>Access WFA database from command fields using MVEL or access WFA database from a WFA Function</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119695#M21408</link>
      <description>&lt;P&gt;Is there an easy way to access the WFA database using MVEL for values not part of a workflow. Essentially I want to be able to run a mysql query as a function.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 20:43:15 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119695#M21408</guid>
      <dc:creator>Ninjas</dc:creator>
      <dc:date>2025-06-04T20:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Access WFA database from command fields using MVEL or access WFA database from a WFA Function</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119702#M21411</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not aware of any method to achieve this directly using MVEL.&lt;/P&gt;&lt;P&gt;As an alternative it's possible to use the "Invoke-MySqlQuery" function with a custom WFA command. EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#'------------------------------------------------------------------------------
#'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
}&lt;/PRE&gt;&lt;P&gt;You can then assign the value from the recordset as a return parameter using the "Add-WfaWorkflowParameter" function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Add-WfaWorkflowParameter -Name "AggregateName" -Value $aggregateName -AddAsReturnParameter $True&lt;/PRE&gt;&lt;P&gt;The return parameters will be available in other commands in your workflow using the "Get-WfaWorkflowParameter" function. EG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[String]$aggregateName = Get-WfaWorkflowParameter -Name "AggregateName"&lt;/PRE&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/matt&lt;/P&gt;</description>
      <pubDate>Sat, 28 May 2016 04:54:37 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119702#M21411</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2016-05-28T04:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Access WFA database from command fields using MVEL or access WFA database from a WFA Function</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119725#M21414</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you help us know the exact reason for this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Akash Shukla&lt;/P&gt;&lt;P&gt;TME&lt;BR /&gt;WFA&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 07:02:28 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119725#M21414</guid>
      <dc:creator>AkashShukla</dc:creator>
      <dc:date>2016-05-30T07:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Access WFA database from command fields using MVEL or access WFA database from a WFA Function</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119732#M21416</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/39312"&gt;@AkashShukla﻿&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MVEL function gives big advatage over getting DB data during command execution. With MVEL fuction&lt;EM&gt; I can the DB data during planning/Previw time&lt;/EM&gt;. The Poweshell function can only get the DB data during execution, so I can't get to see which row will get selected due to SQL query execution &lt;STRONG&gt;during preview&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a BIG advangate of MVEL fuction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sinhaa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 10:05:50 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119732#M21416</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2016-05-30T10:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Access WFA database from command fields using MVEL or access WFA database from a WFA Function</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119765#M21427</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/31984"&gt;@Ninjas﻿&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you really need a function? Whatever a MVEL function to query the WFA DB can get you, you can get it from a User-Input&amp;nbsp;of type Query. Anything and everything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some WFA designer&amp;nbsp;skills maybe needed to solve specfic cases, but it can all be done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here attaching a sample workflow. &lt;FONT color="#FF0000"&gt;You would need &lt;EM&gt;WFA4.0&lt;/EM&gt; for importing it.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My extremely simple use case is to compare the "comment" provided with a WFA scheme name selected. If they both are same , my command executes, else its disabled. So I've used the "Advanced" tab in my workflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. When comment and Delta are same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.netapp.com/t5/image/serverpage/image-id/5387iF7E11D6807ADA7D0/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="WFA_userinput1.png" title="WFA_userinput1.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. When comment and delta are different&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.netapp.com/t5/image/serverpage/image-id/5388iE4B42C9E6BB9E749/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="WFA_userinput2.png" title="WFA_userinput2.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;sinhaa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 11:31:47 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Access-WFA-database-from-command-fields-using-MVEL-or-access-WFA-database-from-a/m-p/119765#M21427</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2016-05-31T11:31:47Z</dc:date>
    </item>
  </channel>
</rss>

