Reverse the order of results

Hi all - I’ve got a scenario working pretty well - Just trying to figure out this one thing. Thought it’d be simple, but I can’t figure it out for the life of me.

Essentially, the scenario gets all the events from a particular Facebook Group and spits them out into Slack. However, the issue is, it’s spitting them out in reverse order (furthest away date at the top). I want it to be chronological - soonest date at the top.

Please see the photos below/attached. Basically just need to flip the way the results are churning out.





Any help would be greatly appreciated.

Hello,

Facebook will likely return a bundle for each event.

You may need to use an array aggregator to aggregate all the bundles into a single array.
Be sure to include the data points you will need for sorting or display.

Then you might be able to use the sort() function on the new array, to sort it by the date.

Then, use another Iterator to iterate that new array.

Finally, use a text aggregator to get the relevant details from each array element to build your final Slack message.

So the modules used are Facebook —> Array Aggregator —> Iterator (apply the sort function on the array you’re iterating) —> Text Aggregator

Hope this makes sense and hope it works!

3 Likes

You might not need sort, just reverse the array using the built-in function after the aggregation

5 Likes

Yea, great point!

If you want to post all the events in a single message (and save on Ops), then use the Text Aggregator prior to the Slack module.

If you want to post each event as a separate message like you’re doing now, don’t use the Text Aggregator and just go straight from the Iterator module to Slack.

Either way, use the reverse() function in the Iterator as Sam suggested.

3 Likes

Thanks Donald and Sam! I’ll give it a go and report on how I go. As you can tell - I’m a total newbie to this sort of stuff lol. Thanks again

Got this working perfectly. Thank you so so much for your help @Donald_Mitchell and @samliew - You guys are absolute legends.

3 Likes