Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

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.

Posted

In psuedocode...

Set Variable [ $alphanum; RandomNumberTable::alpha_number ]

Go To layout [ New table layout ]

New Record

Set Field [ NewTable::someField; $alphanum ]

....

....

...

  • Like 1
Posted

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

Posted

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.

This topic is 4499 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.