August 4, 200619 yr 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.
August 4, 200619 yr Assuming you only want numbers copied... SetField[ Table::Field2 ; Filter(Table::Field1 ; 0123456789 ]
August 4, 200619 yr 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.
August 4, 200619 yr 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
August 4, 200619 yr 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.
August 4, 200619 yr 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
August 4, 200619 yr 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".
August 5, 200619 yr 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.
August 5, 200619 yr I thought a parenthesis was {} and ( was just a bracket. Nevertheless, point taken - luckily i don't use that myself.
August 5, 200619 yr Technically though... you could put the zero at the end. and then fm would read 1234567890 as GetAsText(1234567890) which would be "1234567890"
Create an account or sign in to comment