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

Question

Posted to Laserfiche Cloud

Question

Workflow Question on how to strip off an extension?

asked on February 11, 2020

I have a workflow that pulls in metadata to attach to a PDF file. The PDF file is named per a unique number plus .PDF. The unique number is in the database without .PDF. 

How do I strip off the .PDF? 

0 0

Replies

replied on February 11, 2020

Hi Chris,

I would recommend using Regular Expression to parse out everything from the entry name except for the extension. You should be able to use the following expression to accomplish this:
(\d+).pdf

 

You can use the Assign Token Values activity first and then use that token in your query.

 

Let me know if that works for you.

 

Thanks!

Molly

1 0
replied on February 12, 2020 Show version history

Molly,

I tried using the regular expression in the input parameter but it did not work. I also tried to assign EntryName with the value of (\d+).pdf before my Run Rule and that did not seem to work either. I know I'm missing something silly.

Thank you,

Chris

0 0
replied on February 12, 2020 Show version history

I will assume that the Input parameter of PDFName is being filled in correctly with the whole name like 123.pdf

 

In your workflow where you want to get the name without the extention, you would assign the token where the data is - like %(PDFName), but then you right click on the token and open the Token Editor.  In the Token Editor you have the option to apply a Regular Expression as well as test any applied modifications.

0 0
replied on February 12, 2020 Show version history

I tried to assign a token of EntryName as  a string to the beginning of the Workflow then on the Run Rule function, I did below.

I did do a right click and assign regular expression. I am missing something.

0 0
replied on February 12, 2020

Back up just a bit.  First, where is the file name with the extension coming from?  Is this a document in the repository with the name including the extension?

If so, why are you using an input parameter for it?

If not, then why are you trying to fill the input parameter with the starting entry name?

0 0
replied on February 12, 2020

I have a folder called Import that I am coping image files (documents) named purchased order number.pdf. The Workflow then searches an SQL database for the purchase order number(there is no .pdf in the database). It then moves the file to the AR directory and attaches the data in the database as the metadata. 

If I tell it at import to save the file as purchase order number minus the .pdf extension, the workflow runs. But I would have to remove .pdf off of every file I upload manually.

0 0
replied on February 12, 2020

Bert,

I got it to work! Thank you both for your help! 

 

Chris

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

Sign in to reply to this post.