none
Variable not being updated with interation RRS feed

  • Question

  • Hi,

     

    In a Update Resource activity I’m trying to iterate through a collection of objects (found in previous Update Resources activity) and find the highest number for an attribute.

     

    For example:

    Object 1: XSecurityLevel = 4

    Object 2: XSecurityLevel = 1

     

    I then want to put the highest number in a workflow to use later.

     

    I have configured the updates section activity as:

    Value Expression: IIF(GreaterThan(ConvertToNumber([//Value/XSecurityLevel]), ConvertToNumber(IIF(IsPresent($XSecurityLevel), $XSecurityLevel,0))),[//Value/XSecurityLevel],$XSecurityLevel)

    Target: $XSecurityLevel

     

    What I’m finding is that $XSecurityLevel isn’t being set within the iteration. From the event log:

     

    WAL (2.16.0320.0): 05/19/2017 11:18:58.7712: GreaterThan('4', '0') evaluated 'True'.

    WAL (2.16.0320.0): 05/19/2017 11:18:58.7712: Modified variable '$XSecurityLevel' with value '4' in the variable cache.

    WAL (2.16.0320.0): 05/19/2017 11:18:58.9900: Resolving unresolved function parameter 'IsPresent($XSecurityLevel)'.

    WAL (2.16.0320.0): 05/19/2017 11:18:58.9900: Resolving unresolved function parameter '$XSecurityLevel'.

    WAL (2.16.0320.0): 05/19/2017 11:18:58.9900: IsPresent('') evaluated 'False'.

     

    I also tried with [//Workflow/XSecurityLevel] instead of $XSecurityLevel and it did the same.

     

    1.       Should it work this way with the variable being updated within the iteration and this is a bug?

    2.       If not is there another way of doing this?

     

    Thanks,

    Mark

    Friday, May 19, 2017 10:39 AM

Answers

  • Check the Iteration Wiki at https://github.com/Microsoft/MIMWAL/wiki/Iteration. For the WAL version you have, only things that will be available across iterations are [//Value] expressions.

    Friday, May 19, 2017 11:48 AM
    Owner

All replies

  • Check the Iteration Wiki at https://github.com/Microsoft/MIMWAL/wiki/Iteration. For the WAL version you have, only things that will be available across iterations are [//Value] expressions.

    Friday, May 19, 2017 11:48 AM
    Owner
  • I'd had read that but it didn't register with me.

    I've upgraded to the latest version and it works as expected.

    Thanks

    Friday, May 19, 2017 1:32 PM
  • BTW, instead of iteration, have you tried simply using the SortList() function? And then First() / Last() on it?? Looks like that is all you want here.
    Saturday, May 20, 2017 1:46 AM
    Owner