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.

How Do I copy Field1 to Field2?

Featured Replies

Hi all,

Very Newbie question?

How do I copy field1 to field2, but in field2 only a certain characters will be copied.

Ex. Field1 (10000_NOC)

I only need to copy (10000) not including (_NOC) to field2

I tried using replace record, but don't know how to do a calculation or a script for it.

Thanks in advance.

Assuming you only want numbers copied...

SetField[ Table::Field2 ; Filter(Table::Field1 ; 0123456789 ]

  • Author

Hi Genx,

I tried to use setfield[] in Replace Record Contents under specify calculation, but keep on getting "specified field cannot be found"

SetField[CREW DOCUMENTS::pin ; Filter(CREW DOCUMENTS::file_name; 0123456789 ]

Thanks for the help and sorry I'm very new to this.

I haven't tested your set field, but the filter of [color:blue]0123456789 needs to be enclosed in Quotation Marks, i.e. [color:blue]"0123456789"

HTH

Lee

  • Author

Hi Mr. Smith,

Tired to put Quotes still no luck, do i have other alternative?

I imported some .jpeg (10000_NOC.jpeg) to my table with file name and file path included, so I need another field(serial_number) to copy just the number. Then I will relate this to another existing Table::field(serial_number). I'll be using portals for this.

file_name to pin

10000_NOC.jpeg to 10000

10000_GOC.jpeg to 10000

10000_TCT.jpeg to 10000

10001_NOC.jpeg to 10001

10001_GOC.jpeg to 10001

10001_TCT.jpeg to 10001

and so on.......

Thanks again, Hope you can understand my explanation.

You seem to be asking a different question?

If the data is consistent as you have shown, [color:blue]10000_NOC.jpeg ,

To get 10000 use LeftWords ( Names ; 1 )

HTH

Lee

  • Author

Mr. Lee Smith

Thanks Sir, that really solved my problem.

  • Author

Thank you also Mr. Genx

Lee, it doesn't have to be enclosed in quotes if its a set of numbers only - i've found this to be a general rule in FM, numbers never have to be enclosed in quotes, FM will accept them to directly be 'text' - im assuming they are "reserved characters".

...Maybe it's new in FM8...

i've found this to be a general rule in FM, numbers never have to be enclosed in quotes

They'd better be, when you are using them as text argument. What happens here is this: the Filter() function is a text function, and it expects both parameters to be text. When Filemaker sees a number where text is expected, it automatically converts it to text. Therefore, this:

Filter ( text ; number )

is evaluated as:

Filter ( text ; GetAsText ( number ) )

Now, when you enter 0123456789 as a number, the leading zero is dropped during the evaluation, so:

Filter ( "abc012" ; 0123456789 )

returns "12", whereas:

Filter ( "abc012" ; "0123456789" )

returns "012".

---

BTW, your calculation is missing a closing parenthesis of the Filter function.

I thought a parenthesis was {} and ( was just a bracket.

Nevertheless, point taken - luckily i don't use that myself.

Technically though... you could put the zero at the end. and then fm would read 1234567890 as GetAsText(1234567890) which would be "1234567890"

Yes, you could do that - but it's not good practice.

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.