March 28, 200817 yr Hello all, I need to copy/paste single contact record info out of filemaker and into the mac clipboard. To do this I've created a calc field to concatenate the various fields into an organized text string with line breaks. I have a little script to put the contents of said calc field into the clipboard. So far so good. Here's the thing I can't figure out: related fields - specifically tel numbers and the tel number tags stored remotely and called in by a contact ID number relating the files to each other. How can I get all the related records (list of telephone numbers with tags) into my calc field for pasting? Thanks so much for your help.
March 29, 200817 yr You don't necessarily need a calc field, you can calculate the AppleScript like so: "set the clipboard to " & Quote( contacts::name & " " & contacts::etc ) To get the related info, if it was just one field, you could use the List function. With two fields, you could create a calc field in the related file that concatenates the two and then use List on that. Or, you could script it using a Loop: Set Variable( $count ; Count(related::phone) ) Set Variable( $i ; 0 ) Loop Set Variable( $i ; $i + 1 ) Exit Loop If ( $i > $count ) Set Variable ( $text ; $text & ¶ &GetNthRecord( related::phone ; $i ) & GetNthRecord( related::tag ; $i) ) End Loop
March 30, 200817 yr Author Fitch Thanks - I'll take a look at the List function. By "AppleScript" do you mean just that - AppleScript outside of FileMaker? It's been a while since I messed around with that! :)
March 30, 200817 yr No, he means AppleScript inside FileMaker, using the Perform AppleScript step, which can accept either a FileMaker calculation field or the text of the AppleScript (which is then compiled upon closing the window). If you use a calculation field, then you must escape any quote marks that you want to pass to AppleScript, include returns where necessary, etc.. In other words, AppleScript transcends the boundaries of applications (kind of mystical -), especially in FileMaker's case, which can contain the AppleScript code within one of its objects (I don't know of any other app that can do this, though some are "recordable," which is a whole 'nother thing). Basically you'd be using it to set the clipboard directly, rather than using a Copy step; which you also could do.
March 30, 200817 yr Another place you might want to look is at Brian Dunning's Custom Functions list. http://www.briandunning.com/filemaker-custom-functions/list.php There is one called "GetRows" (also requires "GetNthRow") which can produce a text result of what is in a portal, multiple fields, multiple lines, without having to create a concatenated calculation field. You can even use a tab separator, if you copy/paste one in.
March 31, 200817 yr Author Ah - of course. I remember dabbling with embedded Applescript years ago. The add-on function looks promising - thanks for that link. :)
March 31, 200817 yr Author OK my friends - thank you so much for your help. The custom function is workin' like a charm. Except... I'm stuck on the following: Is there a way to define N in the above function dynamically? The portals the function is reading from don't have a predicable number of records shown. I'd like to copy all of them each time the function is invoked.
Create an account or sign in to comment