Active IQ Unified Manager Discussions

Row Loop variable

rogerhinson
5,528 Views

Hi,

 

I'm starting with a list of IQNs entered in CSV format from an input variable, iqnList, to create multiple igroups based on the server name

 

Example is:  iqn.1994-05.com.redhat:john, iqn.1994-05.com.redhat:joe, iqn.1994-05.com.redhat:bob

 

I created a function, getServerFromIQN that takes the iqn name and just leaves the host name.

 

I create a row loop for Number of Time with Number of Times equal to getSize($iqnList)

 

The Variable Index is set to iGroupIdx

 

Variable Name is iGroupName

Initial Value is getServerFromIQN(getValueAt($iqnList,1))

Expression is getServerFromIQN(getValueAt($iqnList,iGroupIdx+1))

 

My problem is that if the the Expression is performed after the last item in my list and so there isn't an iGroupIdx+1 to look at and I get an error.

 

How can I set the Expression to only evaluate if the size of the list is less than the iGroupIdx?  I tried an if/then, but got an error evaluating the expression.

 

This is WFA 2.2.

 

Thanks,

Roger

 

 

 

1 ACCEPTED SOLUTION

karale
5,469 Views

Hi Roger,

Can you try

(iGroupIdx<= getSize($iqnList))?getServerFromIQN(getValueAt($iqnList,iGroupIdx+1)):0

in express column?

View solution in original post

4 REPLIES 4

abhit
5,518 Views

Hi:


Can you please try with:

getServerFromIQN(getValueAt($iqnList,iGroupIdx));

 

Regards

Abhi

 

rogerhinson
5,505 Views

Hi,

 

When I remove the +1, I don't get an error, but it loops through the first item twice.  I'm doing a NoOp to see if the igroup exists before creating it and end up with incorrect results when I remove the +1.

 

I think I need the expression, to not calculate on the last iteration.

 

I've attached the dar file to help out.

 

Thanks,

Roger

 

 

karale
5,470 Views

Hi Roger,

Can you try

(iGroupIdx<= getSize($iqnList))?getServerFromIQN(getValueAt($iqnList,iGroupIdx+1)):0

in express column?

rogerhinson
5,458 Views

Thanks Karale,

 

That's what I was looking for..  I need to make it just < instead of <=, but now it works just as I wanted..

 

Thanks again,

Roger

 

Public