Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

How to proceed further downstream in the absence of Search Output?

Avatar

Level 3

I would like to search a data store, and if the search turns up no results, I want to proceed down a specific route downstream of that module (specifically, "there's no record for this already? then let's create one!")

 

However, whenever there is no Output for a search module, the scenario ends and I can't continue. 

gardensurfer_0-1727851638686.png

 

Is there any way to accomplish my use case such that the absence of data can serve as a condition to continue processing down a certain route? 

 

Thank you. 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Level 3

OP again. I came up with something that worked. Instead of searching the DataStore and using NO output as the condition to continue, I searched the DataStore first for all records and then compiled all of them into an array. I could then could use a filter condition with Array operators to find out if the value I'm looking for is contained or not contained in the array. 

 

gardensurfer_0-1727858311941.png

 

 

This seems to have gotten me past my hurdle, though I have to continue testing. 

Avatar

Level 5

I don't know how you have your data store setup because I've never used them but comparing it to {{emptystring}} checks for empty things. Go back to your first screenshot using the router and make a path that says if record == emptystring , create record. I usually create my path with a condition then mark the other as fallback to default it.

 

Lawson02_0-1727906371751.png

 

Avatar

Level 3

OP again with an update. I received excellent support from Adobe's @yashpandey who provided me with precisely the solution I was looking for, and I want to share it. 

 

Earlier, I had missed an Advanced Setting in the Data Store - Search module, a set of radio buttons labeled "Continue the execution of the route even if the module returns no results":

 

gardensurfer_0-1728582155321.png

 

So now that I've selected Yes, the execution continues and it branches into 2 paths differentiated by the "length(array)=0" filter (the other path filter being Array length greater than 0) shown in this screen cap: 

 

gardensurfer_0-1728587619512.png

 

 

And that is how I was able to implement my use case. Many thanks again to Yash!