Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

extract text string and paste into other field

Featured Replies

Hi, I need to extract a bit of text from a field and move it into another field.

Here's what I've got. My field "Source" contains a long file name for the image which I have imported into that record. I would like to copy part of this file name and paste it into a field called "Album Name".

The contents of the Source field look like this:

file://C:/British Aviation Sqn Markings/Thumbnails/05 - BE2e - test aircraft - camouflage.tif

I would like to take the text between "C:/" and "/Thumbnails" and copy it to the Album Name field.

All help and suggestions appreciated!

Set Field[ TableName::Album Name ;

Let( [ source = TableName::SourceField ;

rawpath = Position( source ; "/" ; 1 ; 3 ) + 1 ;

rightLength = Position( source ; "/Thumbnails" ; 1 ; 1 ) + Length ("/Thumbnails") + 1 ];

Middle( source ; rawPath ; Length(source) - rawpath - rightlength )

)

should work

Or:

Let ( [

start = Position ( text ; "/" ; 1 ; 3 ) + 1 ;

end = Position ( text ; "/" ; 1 ; 4 )

] ;

Middle ( text ; start ; end - start )

)

You see, i thought about that, but what if there's another sub folder between File://c:/ and /templates?

  • Author

Great - thanks for these - I'll try them out now.

And yes, there are occasionally multiple subfolders between "C:/" and "/Thumbnails".

  • Author

ok, newbie alert -

I'm just using Filemaker Pro, not Developer. Am I able to use this script in Pro? And if so, do I paste it into the "Specify Calculation" dialog box for the Set Field command? I've been trying to do it this way, but always get a message to insert an operator after the first line.

Thanks again! Sorry for my newbishness.

Yeh...

Just Go into ScriptMaker, Make a new script, choose set field, choose your destination field (album name).

Next, choose specify calc

Let( [ source = [color:blue]TableName::SourceField ;

rawpath = Position( source ; "/" ; 1 ; 3 ) + 1 ;

rightLength = Position( source ; "/Thumbnails/" ; 1 ; 1 ) + Length ("/Thumbnails/") + 1 ];

Middle( source ; rawPath ; Length(source) - rawpath - rightlength )

)

Replace the blue bit with your source field.

And by the way, Welcome to the Forums! :)

Come to think of it, if Thumbnails is always the folder before the file, you could use a slightly modified version of LaRetta's calc below. (text is just your source field)

Let ( [

start = Position ( text ; "/" ; 1 ; 3 ) + 1 ;

end = Position ( text ; "/" ; 1 ; PatternCount( text ; "/" ) - 1 )

] ;

Middle ( text ; start ; end - start )

)

  • Author

Ok, I'm definitely getting there. At this point it's copying various string lengths into the Album Name field - sometimes it's the first word, sometimes it's all the way through "Thumbnails"

example:

British Aviation Sqn Markings/Th

or

British Aviation Sqn Markings/T

or

British Aviation Sqn Markings/Thumbnails/09 - RE8

"Thumbnails" will always be the folder AFTER the file name that I want, btw.

Thanks so much!!!

Edited by Guest

  • Author

Last one works like a charm!

You people are geniuses!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.