FlowsBook a callSign inCreate free accountSign up
Building flows

Repeat until: keep looking until enough is found

Run a block that finds things again, a little wider each round, until it finds enough.

By the xMap team · Updated

Open it in the app

Flows never loop back on themselves: a link that goes back to an earlier block never runs. To keep looking when a block found too little, put Repeat until (Logic) right after that block, with only that block linked into it. The block before it must be one that finds things, such as Nearby places, Job postings, Regional data or Run another flow.

  1. Choose Until: at least a number of items, at least one item, a number of items that meet a rule (the same rules as Filter), or a number of items that get through the blocks after it (the Filter, Branch (Yes), Remove duplicates, Calculated field and Sort and limit blocks right after it, so you do not write their rules twice).
  2. Choose Each round: Automatic (a new Repeat until starts on it), Widen the distance (the radius of the block before it doubles, or grows by the kilometres you set), Find more (its Most places grows), or Try the next value in a list (pick one of its settings, such as Types of place or Location, and write the next values, one a line).
  3. Choose At most: 2 to 5 rounds, the block’s own first run being round 1.
  4. Choose Keep: everything found, without duplicates, or only the last round.

Automatic reads each answer. When it came back full (as many places as Most places keeps), a wider search would bring back the same number, so Most places grows to what is still needed and the distance stays; when Most places is already the most it allows, no round is run. Otherwise the distance grows by as much as the places found so far suggest, to the next distance the block allows, so it usually needs fewer rounds than doubling. A round that the credits left would not cover is made smaller, or not run.

Each extra round is paid like a run of the block before it, but only for the items it adds: places an earlier round already found come back free. When the run’s credits would not pay for another round, it stops and keeps what it has. Widen the distance no longer spends rounds on an answer that is already as full as Most places keeps. The run shows every round and why it stopped, for example "Round 1: 12 found within 1 km; round 2: 31 found within 2 km; stopped: 30 reached". A Repeat until that stops before its target passes with a warning; the run does not fail.

Templates that use these blocks

Related articles

Still need help?

Ask xMap in the app answers from this help and your own flows. Our team is one message away.