FileMakerHarry Posted September 19, 2012 Posted September 19, 2012 Hello Board, I have a table with a list of randomly generated alpha-numberic codes in it. When hitting a button, I want a script to go to that table, to the first field, copy the contents of the field and then put it into the field of another table. There are additional steps but this is the first bit I'm having a problem with! I've tried using the Get (ActiveFieldContents) by first using GoToField but that hasn't returned anything. I've tried GoToField, SelectAll, Copy All, GoTo(target)Field, Paste, but that doesn't work either. Should i use SetField or similar? After it has got the number, i need to delete that record in that RandomNumberTable, do a NewRecord and then loop the script a pre-specified number of times, but I will work that out after this bit. Thanks for your help.
mr_vodka Posted September 19, 2012 Posted September 19, 2012 In psuedocode... Set Variable [ $alphanum; RandomNumberTable::alpha_number ] Go To layout [ New table layout ] New Record Set Field [ NewTable::someField; $alphanum ] .... .... ... 1
FileMakerHarry Posted September 19, 2012 Author Posted September 19, 2012 Thank you for putting this up. I've spent a bit of time reading about the Set Variable and Set Field functions. So, the Set Variable is just like a clipboard to store a bit of data on the fly? When does that variable get destroyed or lost? My Script is: Set Variable [$AlphaNum; Value:RandomNumbers::RandomAlpha] Set Field [TestTable::UI Test Hole] But i can't get any further than this. The last line should, by my thinking, be Set Field [TestTable::UI Test Hole; $AlphaNum] Although i get an error in the script builder saying it is expecting an operator or other at the front. If my AlphaNum table has 10000 records, will the Set Variable just take the first number in the table? Can you Copy/Paste a calculation field result? That's another way to do this job, if you can? Copy the field, paste it into another field? Thanks! Harry
comment Posted September 20, 2012 Posted September 20, 2012 When hitting a button, I want a script to go to that table, to the first field, copy the contents of the field and then put it into the field of another table. To expand a bit on John's example: Go to Layout [ RandomCodes ] Go to Record [ ] Set Variable [ $code ; RandomCodes::Code ] # Go to Layout [ Original Layout ] Set Field [ AnotherTable::SomeField ; $code ] Note the change of context between "loading" the variable and "delivering" it to its destination. There is also an assumption here that the script starts at a layout of "AnotherTable" and that the current record in this table is the target record for this operation. When does that variable get destroyed or lost? A local $variable - at the end of the script. A global $$variable - at the end of the session (unless you set it to empty before that). Can you Copy/Paste a calculation field result? You can, but it's not good practice because it interferes with user's clipboard.
FileMakerHarry Posted September 25, 2012 Author Posted September 25, 2012 That's really concise and has answered my questions, thank you so much! It's really clear to me how it works, so I'll start by implementing that. Thank you again, Comment.
Recommended Posts
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