Jump to content

How Do I copy Field1 to Field2?


This topic is 5603 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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".

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 5603 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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