altair Posted August 4, 2006 Posted August 4, 2006 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.
Genx Posted August 4, 2006 Posted August 4, 2006 Assuming you only want numbers copied... SetField[ Table::Field2 ; Filter(Table::Field1 ; 0123456789 ]
altair Posted August 4, 2006 Author Posted August 4, 2006 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.
Lee Smith Posted August 4, 2006 Posted August 4, 2006 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
altair Posted August 4, 2006 Author Posted August 4, 2006 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.
Lee Smith Posted August 4, 2006 Posted August 4, 2006 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
altair Posted August 4, 2006 Author Posted August 4, 2006 Mr. Lee Smith Thanks Sir, that really solved my problem.
Genx Posted August 4, 2006 Posted August 4, 2006 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".
comment Posted August 5, 2006 Posted August 5, 2006 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.
Genx Posted August 5, 2006 Posted August 5, 2006 I thought a parenthesis was {} and ( was just a bracket. Nevertheless, point taken - luckily i don't use that myself.
Genx Posted August 5, 2006 Posted August 5, 2006 Technically though... you could put the zero at the end. and then fm would read 1234567890 as GetAsText(1234567890) which would be "1234567890"
comment Posted August 5, 2006 Posted August 5, 2006 Yes, you could do that - but it's not good practice.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now