Active IQ Unified Manager Discussions

Needing some MVEL help

cscott
3,390 Views

Hi,

     Preqs:

     WFA 2.1

     2xDFM@5.2 7-mode

     I am trying to build an advanced conditional on whether to execute a command in a workflow.  I am polling two DFMs with PM installed, one in the US and one in EMEA and trying to keep as many "joint" workflows as I can.  In the process of that I am trying to determine whether to skip a command based off of filer names, but cannot figure out the proper MVEL syntax.

Execute this workflow if the following expression is TRUE

$src_array contains 'netappusfl[12345][ab]' || '[Nn]etappuso[kh][12345][ab]'

This expression is more convoluted as certain US based frames have uppercase "N" and others do not

So I want to execute this command if the filer names are netappusfl1a, netappusfl2b, Netappusok1a, netappusoh2b, etc

and a second row that will excute if

$src_array contains 'netappemeauk[12345][ab]' || 'netappemeabud[12345][ab]'

Neither expression can be evaluated to a Boolean per the WFA preview.  Finding good MVEL examples has worn me down, tons of information on &&, but very little on ||.  Is this a syntax error on my part? 

I have tried using

$src_array strsim 'netappusfl[12345][ab]' || '[Nn]etappuso[kh][12345][ab]' 

and also tried

$src_array strsim 'netappusfl[12345][ab]' || $src_array strsim '[Nn]etappuso[kh][12345][ab],

both of which return syntax evaluation errors.

Thanks for any direction in advance,

Scott

2 REPLIES 2

mgoddard
3,390 Views

Hi Scott,

Have you looked at functions? These are a great way to consolidate common logic into one location. It's also easier to write complex MVEL, and you can use java functions more easily log the regex matcher. Checkout the function nextNamePaddedBy for regex examples.

Michael.

cscott
3,389 Views

Thanks Michael,

     But I decided to come at it from a completely different angle, though after some reading today I set your answer to helpful.  My biggest driver is to have as few jobs as possible that are not 100% certified commands, but I may use custom functions for a couple of my own team's jobs. I set the DFM name to a variable in the monitor refresh/wait for refresh fields.  Then built an SQL query to pull that information:

$pm_dfm query

Select

     dataset.dfm_name

From

     storage.dataset

Where

     dataset.name = '${sv_dataset}'

$sv_dataset is another query earlier in the workflow that pulls the dataset name based off of the array name that the volume is being created on.

- Scott

Public