How to proceed further downstream in the absence of Search Output? | Community
Skip to main content
gardensurfer
New Participant
October 2, 2024
Question

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

  • October 2, 2024
  • 2 replies
  • 820 views

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. 

 

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. 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

gardensurfer
New Participant
October 10, 2024

OP again with an update. I received excellent support from Adobe's @17368419 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":

 

 

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: 

 

 

 

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

 

 

gardensurfer
New Participant
October 2, 2024

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. 

 

 

 

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

Lawson02
New Participant
October 2, 2024

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.

 

 

Sven-atClient
New Participant
October 11, 2024

I would check whether the key "exists"