Advancing the first bundle coming out of an iterator

:bullseye: What is your goal?

I am trying to configure a scenario which starts with a (1) Notion Search Objects … which will grab the DB contents … then (2) from those results, apply a filter to advance those pages who qualify ( “last edited time’ later than 'last backup time”. This then produces a short-list. From this ‘short-list’, I’d like to then advance *only the first bundle to an HTTP POST.

:thinking: What is the problem & what have you tried?

I’ve tried many combinations of iterators, array aggs, repeaters, filter expressions, etc … but haven’t yet succeeded. While I want only the first bundle from the iterator, I see that every bundle order position = 1. So I’m lost how to isolate just the first bundle.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hey there,

What are you iterating over? Cause search modules already return separate bundles for each item found.

Hi – thanks your thoughts.

Good question … I’m not sure I need an iterator at all. ( I was trying to isolate only the bundles which qualify to advance ) Like you said, the output from Search Objects indeed generates nice bundles.

I welcome any suggestions how to best configure this. To clarify, from the results of ‘Search Objects’, I’d like to advance only those which qualify ( filter = ‘last edited date’ later than ‘last backup date’ ). Then of that remaining ‘short-list’ … advance ( and then process ) only *one bundle. In this case, it doesn’t matter which single bundle advances … only that it’s from the short-list. ( can be first, last, doesn’t matter ).

I’d be grateful for any guidance.

UPDATE: I discovered a separate chat ( How to pass a limited number of bundles from an iterator ) which solves this issue. I learned to use ‘slice’. Solved, thanks! :white_check_mark:

1 Like

Actually, you don’t need te Iterator at all if you already have the aggregated Array. Just use first(46.Array[]) wherever you need the value.

@damato

1 Like

The Search module already returns an iterated array. Aggregating it and then iterating it again is a waste of operations. And all that the slice() does here is grab the first bundle, which you can just limit in the filter after the Search module., or in the search module it self.

1 Like