You are viewing limited content. For full access, please sign in.

Question

Question

For Each Value custom activity

asked on January 6

He everyone, 

 

Is there any sample code on how to create a looping "For Each Value" style of custom activity?

 

Regards, 

 

Ben 

0 0

Replies

replied on January 7

Hi Ben - Whatever you are doing sounds interesting.  The best I have been able to do is to load MV values into an array (collection would also work) and then do array things.  But the objects don't exist outside of the script task which I suspect is the problem you are looking to solve:

 

            For Each Value as Integer in GetTokenValue("RetrieveFieldValues_Bill Pages_All")
                Redim Preserve nArray(nIndex)
                nArray(nIndex) = Value
                nIndex = nIndex + 1
            Next

 

 

0 0
replied on January 8

Hi Bill, 

happy new year!

Yep, an array wouldn't work in this case. Loading the values into a JSON-formatted value would solve the problem *but* passing larger values around wouldn't be very efficient. Even if the values were smaller, using the JSON reader activity, would still require additional activities, which I could just build into the custom loop activity.  The extra complexity wouldn't be very elegant.

I've tried creating tokens of multi-dimensional arrays, arrays or arrays, arrays of collections, collections of arrays, and datasets. I think I even tried a collection of collections. Miruna has anyway confirmed tokens can't be created like this, which is why I'm trying the for...each loop approach.

I can bite the bullet, code everything into one customer activity and reduce the number of reusable custom activities that I'm creating. Ach well. At least the result will run faster.

-Ben

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.