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

Question

Question

Removing underscores

asked on August 8, 2014

 Have the following I'm importing via Import Agent AR Invoice_363710_25_OSYKA_ELEMENTARY and I would like to take the Name and put it into a template field, however, I would like to get rid of the underscroes, as well as the name could contain more or less underscores (spaces) in it.  I'm trying to figure out the best reg. exp. to use?

 

Thanks!

1 0

Answer

SELECTED ANSWER
replied on August 8, 2014

You are still able to use Regular expression on top of all that customization to do it in one step, but that depends on how you will know what to get from the information. Is it just the last two words of the original name? 

 

 

I added in "Trim" to the functions, to ensure we dont have a space messing things up at the end of the filename we originally had

4 0

Replies

replied on August 8, 2014 Show version history

To get this right, you are using workflow?

 

you should be able to to use the function called "Split" to separate out the title by '_' and then have the token displayed with all values separated by a space.

 

 

To get to this menu, set the document to be renamed to it's original name, based on the token you have for it. Then, "Right-Click" and select "Token Editor..."

 

EDIT:

The reason you would wanna use the function instead of Regular Expression, is Regular Expression is used to match data that meets the predefined guidelines you set up with your expression. What you want is to change the data to have a particular format by replacing underscores with spaces. This either requires you to use the method above, or pattern match everything in the name that isn't an underscore, which then would be the multi-value token containing the various parts of your document name. That is quite messier and also may be less consistent. In the end though, you would still need to apply the index to separate all values with a space, so doing everything in one step makes it much easier.

3 0
replied on August 8, 2014

Perfect...do I have to do this in 2 steps to parse out the info to then just get the name " OSYKA ELEMENTARY" to populate the field?

0 0
SELECTED ANSWER
replied on August 8, 2014

You are still able to use Regular expression on top of all that customization to do it in one step, but that depends on how you will know what to get from the information. Is it just the last two words of the original name? 

 

 

I added in "Trim" to the functions, to ensure we dont have a space messing things up at the end of the filename we originally had

4 0
replied on August 8, 2014

So I have most of it working now, but I'm still running into issues with 2 names that I can't seem to parse:

 

AR Invoice_365107_25_SOUTH_PIKE_SCHOOL_DISTRICT (13) ends up like this after going through my workflow SOUTH PIKE SCHOOL DISTRICT (  

 

My expression is as follows:%(Entry Name#@Split(_);Trim@##[ ]##<\w+ \w+\s\d+\s\d+\s(.*)\S+?\d+?\S+?>#)

 

The other is: AR Transmission_33319_1220472_v6.csv (2), I'm trying to use the last number to do a query (1220472), however, it seems to always have a proceeding white space so the query is failing.

 

My expression for this is: %(Entry Name#@Split(_);Trim@##[ ]##<\w+\s\w+\s\d+\s(\d+)>#)

 

It's not always going to be 7 digits...it may be 6 as well. 

1 0
replied on August 8, 2014

what is the intended output you were hoping for for both of these?

in the case of the first one, the '(' is causing the matching to finish and not find anything more in the string. 

 

For the second case, have you tried using that token as the value for a new token. then when using the query, you apply "Trim" again to this token. I have not actually been able to get your preceding white space you are reporting

2 0
replied on August 8, 2014

Sorry...for the first one the output should be SOUTH PIKE SCHOOL DISTRICT

 

For the second one...I think it works...might be something wrong with my query.

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

Sign in to reply to this post.