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

Question

Question

Rename Entry

asked on October 24, 2024

I am trying to figure out the correct way to Rename a document entry name in Workflow. I want to only capture any characters before a "-" and remove everything after.

Examples:   Performance Evaluations - Smith, John A     ----  END RESULT = Performance Evaluations

                    Personnel Action Form - Smith, John A                                             Personal Action Form

                    Funeral Leave - Smith, John A                                                              Funeral Leave

 

I want to only retrieve "Performance Evaluations" ... However I will have numerous files the same way, so not every file will start with Performance but they all will have a "-" in them. I have been trying in the token dialog and coming up short since the first part of the name is not the same length.

 

These documents are all coming in from Forms, I could take the easy way out and remove the it in Forms however if in workflow there is an issue with a document you would know where is should have gone without opening it...  I am applying a template to all of them as well for metadata.

 

0 0

Replies

replied on October 24, 2024 Show version history

Create a token using the (Pattern Matching) utility tool from the Laserfiche Workflow Toolbox. With this utility tool, you can create a token by making the  (Input) parameter the Global Token value (EntryName). You can use the following pattern (In bold): \D+(?= -)

You can now use this as a new token in your (Rename Entry) utility.

Please reference the attached screenshot.

LFSample.JPG
LFSample.JPG (31.14 KB)
3 0
replied on October 24, 2024 Show version history

Another option is to use the Split function in the token editor:

You could use the Token Editor dialog to split the token on the dash, trim the whitespace, and return the first index (the first bit of text before the dash).

I typically prefer this approach for simple scenarios because you can just use it directly on the token wherever you're using it, such as within the Rename Entry activity.

3 0
replied on October 24, 2024

If you can guarantee that the starting part of the document names will not have a "-" in it until you want it to, you can use either of the following

  1. Split on ' - ' and get index at 1 (note the spaces here)
  2. Use regex "([^-]+) - " note the spaces here
1 0
replied on October 24, 2024

OMG - Thank you both!  I went with Jason's option first. I originally was trying to use the Trim function. 

 

But thank you both for the recommendations! 

 

 

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

Sign in to reply to this post.