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

Question

Question

Search Results in Workflow

asked on January 6, 2014

When working with the "Search Repository" activity in Workflow 9.1, is it possible to manipulate in which order the results come back?  I believe by default, it returns the results in alphabetical order.  Thank you!

1 0

Answer

APPROVED ANSWER
replied on January 8, 2014

You could do a Routing Decision in WF. If the doc name is A or B, append the copied pages. If it's C, then insert them at the beginning of the document.

1 0

Replies

replied on January 7, 2014

You might want to do a search then use a script or SDK Script activity to more directly re-order your token. This way you do not have to go around the problem but attack it like any other array type data type. There are plenty of simple sorting algorithms out there that are already implemented in any language you would need and would only need a small amount of modifications to get you going.

1 0
replied on January 8, 2014

I think you'd have to add a branch whenever the order changes. For the 3 doc case (A,B,C to C, A, B), I'd do 2 branches: (A or B) and C. If you had A,B,C,D and wanted to go to something like C, D, A, B, it would get more complicated. You could go with (A or B), C, D, but you'd have to keep track of how many pages are in C and insert the pages from D after that. So it gets more convoluted the more document you have.

 

But, if you were to have a choice of ordering, what would the sort order be based on for your documents?

1 0
replied on January 6, 2014

It could be re-ordered using whatever logic you like using Assign Token Values and nested for each.

 

You would first need to create a multi-value token and assign a value of the Entry ID for the first result.

 

Then for each entry nest a conditional decision in a for each value to compare the entry with each Entry referenced in the multi-value token. (which is only one at the moment but will increase during the loop).

 

As you cycle through the entries listed in your multi-value token you will know your entry belongs above the first entry found to be out of order based on your ordering criteria.

 

You can copy each entry before and after into temporary multi-value tokens within the loop. Then re-populate the original multi-value token in the correct order as you add your new entry ID. The Assign Token Values has the capability to overwrite and append.

 

This could get somewhat complicated depending on how you want to order the results.

0 0
replied on January 7, 2014

There is no way to specify the order of the search results. Can you describe what you're trying to accomplish and what order would you like the results sorted in?

0 0
replied on January 7, 2014

Thank you all for the replies!

 

I have 3 documents in a folder (named A, B, and C for simplicity) which have the pages generated.  I have a Workflow Business Process that:

  1. Creates an empty entry.
  2. Runs a "Search Repository" activity to find the 3 documents within this folder.  
  3. For each of the entries, I have it copying the current entry's pages to the empty entry.

 

I'd like the newly created entry to have a specific order of documents (C, A, then B).  However, by default it is ordering the pages as (A, B, then C).  

 

I was able to do a workaround by doing steps 2 and 3 twice.  The first time I would configure the search to just pick up C.  The second time it would pick up A then B.  I'm curious to see if there's a more efficient way of doing this.  Thanks for all the help!

0 0
replied on January 8, 2014

Thanks Miruna!  

 

For simplicity's sake, I only had 3 documents in the folder.  If I were to have 10 documents in the folder that need to be in a specific order, would I have to create a branch for each of those?  Thanks again!

0 0
replied on January 8, 2014

I see, thanks! 

 

All the documents have a Vendor Name as a field.  If I had my choice, I'd like to sort it by the Vendor Name.  I could just rename the documents in there to begin with the Vendor Name but I'm trying to see if there's a way without adding a field in the name.   Thanks again!

0 0
replied on February 10, 2014

I am actually running into the need for sort-ability in WF Search results as well.

The situation I am having is the customer is using shortcuts for keeping a list of pending items.

I want the search to sort in a date field order, so I can just grab the first one which would be the earliest.

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

Sign in to reply to this post.