Friday, March 24, 2023

Reduce to Dashboard

vintage sausage grinder

When developers use DataWeave, they often come to rely on the reduce() function to fill in any gaps left by the standard Core library. Although filter() and joinBy() and splitBy() and even groupBy() could be implemented by simply using reduce(), we favor the Core library functions as the best implementation of those patterns.

On the other hand, polishing your reduce() game will get you through tight spots sometimes when the requirement is idiosyncratic, or when the standard function just won't do.

So we'll take a data set that represents a crude inventory, and use reduce() to extract a dashboard snapshot showing projected revenue, and potential growth through untapped inventory.

(BTW, if more about DataWeave is not your cup of tea, never fear. We are talking about the onset of automation in the workplace next. So drop by again.)

Reduce to Dashboard

When developers use DataWeave, they often come to rely on the reduce() function to fill in any gaps left by the standard Core library. Altho...