O Happy Array!

I've recently had to read through a lot of data within ProcessFlow, comparing lists values, etc. and have found that using arrays is a great way to read and compare data.

Most recently I built a flow to review the HR Supervisor records and compare it against ProcessFlow Approvers to make sure the records were in sync. My old method of doing this was to cycle through HRSUPER with a Query while running another Query within the HRSUPER Query loop to see if a matching record existed in PF Admin.

While this did work, I really didn't like running that 2nd Query 900 times! My solution this time around was to run both queries once, saving the values into two different arrays.

I then used a couple of JavaScript Expressions (within an Assign node) to compare my two arrays - one to produce a new array of new Approvers to add and the other to produce a list of Approvers to remove from PF Admin.

I then cycled through these two new arrays with a DataIterator node and used 3 WebRun nodes to add or remove the PF Admin records (User, User Task, User Task Category) as I cycled through the records.

You can do a lot with arrays. I used them recently within Design Studio to assign values from a DME and manipulate and sort the records before presenting them on my form.

O Happy Array!