ddinisco Posted November 12, 2012 Posted November 12, 2012 I am sure this is simple, but I can't figure it out. Need to extract the file name after 'remote:' and before 'FILE' remote:photo_todo.rtf FILE:jbDeliverables/deliverable_list_document/photo_todo.rtf Thoughts?
No_access Posted November 12, 2012 Posted November 12, 2012 Set variable, $pos1 the location of Remote:, ie use Position ( text ; searchString ; start ; occurrence ) set variable, $pos2 the location of file. grab everything in between with Middle ( text ; start ; numberOfCharacters ) numberofcharacters if difference between $pos's, dont forget to take into account the length of the words now run through a loop to get multiple filenames. increment occurrence by 1 in loop.
LaRetta Posted November 12, 2012 Posted November 12, 2012 To be more specific in case you are new to FM (since you do not show your self-rating), the calculation might look like this: Let ( [ start = Position ( text ; "Remote:" ; 1 ; 1 ) + Length ( "Remote:" ) ; end = Position ( text ; "File:" ; 1 ; 1 ) - 1 ] ; Trim ( Middle ( text ; start ; end - start ) ) ) You can then use it in script to loop as indicated by No_access or you can use Replace Field Contents. Be sure to back up first. :^) Also, are you really still on version 8? If not, it will help if you update your profile. Thank you!
ddinisco Posted November 12, 2012 Author Posted November 12, 2012 Thanks LaRetta and No_access that did the trick. Updated my profile too...haven't been here in a while.
Lee Smith Posted November 12, 2012 Posted November 12, 2012 You can try it this way. Trim ( Let ( [ prefix = ":" ; suffic = "." ; start = Position ( YourField ; prefix ; 1 ; 1 ) + Length ( prefix ) ; end = Position ( YourField ; suffic ; start ; 1 ) ] ; Middle ( YourField ; start ; end - start ) ) )
LaRetta Posted November 12, 2012 Posted November 12, 2012 Hi Lee!! The only reason it is recommended to include text instead of focusing on just the colon or period is that those single characters can exist in other locations within the string. By including everything which you know is unique to the string, you can guarantee getting the correct results every time.
Lee Smith Posted November 12, 2012 Posted November 12, 2012 Hi LaRetta, I posted this before I saw you had posted. You are right about, the more start and end information you can use, the better. Anyway, this gives s/he a variant on the formula that can help them in the future.
LaRetta Posted November 12, 2012 Posted November 12, 2012 Absolutely! Variants of a technique or calculation also shows the underlying principle a bit more. :^)
Recommended Posts
This topic is 4451 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now