Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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.

Posted

Assuming you only want numbers copied...

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

Posted

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.

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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.

Posted

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

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

Posted

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

This topic is 6688 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
×
×
  • Create New...

Important Information

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