You are viewing limited content. For full access, please sign in.

Question

Question

Find Unique Numbers Workflow

asked on April 20, 2021 Show version history

I'm doing a search that returns multiple documents many with the same App Number metafield data; I only need a single instance for each of these app numbers. I believe I am missing regex in one of my token values that is necessary; I have underlined this section.

 

Currently my Workflow is only inserting one single value.

 

0 0

Answer

SELECTED ANSWER
replied on April 22, 2021

There was a much simpler solution to my specific issue:



 

0 0
replied on December 8, 2022

Can you elaborate on this solution?  I am also looking to remove duplicate results based on a certain field value.

0 0
replied on December 8, 2022

For sure! There is a token function called "remove duplicates" that you need to implement in a secondary Assign Token Values. And that will do all the hard work for you.

0 0
replied on December 8, 2022

Let me know if you need screenshots to find it!

0 0

Replies

replied on April 21, 2021 Show version history

A part of your problem is that every time the For Each Entry loops through and runs the Retrieve Field values, it over-writes the values that are previously there, so you will only get the values from the last entry in the For Each.  At the top of the workflow, add a Create Token Values activity and make multi-value tokens for the data you wish to save from each entry.  Then in the For Each Entry, after the Retrieve Field Values, add another Create Token Values and use the Modify to update the token(s) created in the first Create Token Values activity.  This would be the location to add logic to check if the value already exists before adding it again.

1 0
replied on April 21, 2021

This workflow has the potential of being very inefficient because you could be returning hundreds of documents to loop through to find a single new value.

It would be more efficient if you had a starting rule on either document creation or changes that processes individual documents. You can check if its field values exist in the database and insert them if they don't.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.