Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

script and copying data from a field

Featured Replies

I have a field that is specified as a button. When I click on the button, a pop-up window appears where I select what data I want to assign to the field that was clicked on for the current record. When no data is assigned to this field, it reads Please Specify Company.

I have written a script that duplicates most of the fields in the current record and puts their contents in a new record, the Company field being one of them. Unfortunately, my script is not duplicating the company name from the current record to the new record. I suspect this is because the Company field is a button that the user clicks on in order to get a window where the Company is selected.

My script steps are:

1. Go to Record/Request/Page (Previous)

2. Go to Field [select/perform; Company::Name]

3. Copy [Company::Name]

4. Go to Record/Request/Page (Next)

5. Go to Field [Company::Name]

6. Paste [select; Company::Name]

While this seems logical to me, it is not doing what I would like it to do as outlined above. Is this not possible in any version? Is it only possible in v8? Is it possible in v7, and I am just not using the proper script steps? Any insight would be appreciated.

Thanks for reading!

Edited by Guest

I'm not quite understanding why your one filed is not being duplicated with all of the others, because a duplicate record should be the same.

You would be wise to use "Set Field" instead of copy paste here to. Copy requires the field to be on the layout, Set Field doesn't. Also, you are changing the Clipboard when you do that.

HTH

Lee

  • Author

I am not using the duplicate record (Apple+D) command. I am duplicating some of the fields on a layout when creating a new record. This is how I want to do this. I know I have a low post count, and I will not claim to be a FMP genius, but please trust me on this.

I edited my script so that the steps are as follows:

1. Go to Record/Request/Page (Previous)

2. Go to Field [select/perform; Company::Name]

3. Copy [Company::Name]

4. Go to Record/Request/Page (Next)

5. Go to Field [Company::Name]

6. Set Field [select; Company::Name]

The one field is still not having its value duplicated to the new record. Does anyone know if there is an error in my script, or am I trying to do something that cannot be done?

You would need to copy the field before going to the new record to paste

Copy [ Untitled::Field A ] [ Select ]

New Record/Request

Paste [ Untitled::Field A ] [ Select; No style ]

Or

after creating the new record, you would need to navigate back the Previous record, copy the field then move back to Next record and past.

Go to Record/Request/Page [ Previous ]

Copy [ Untitled::Field A ] [ Select ]

Go to Record/Request/Page [ Next ]

Paste [ Untitled::Field A ] [ Select ]

Lee

If your records are unsorted, and you are not on the last record before creating a new one, then going to the previous record will NOT return you to the source record.

No DUH

  • Author

after creating the new record, you would need to navigate back the Previous record, copy the field then move back to Next record and past.

Go to Record/Request/Page [ Previous ]

Copy [ Untitled::Field A ] [ Select ]

Go to Record/Request/Page [ Next ]

Paste [ Untitled::Field A ] [ Select ]

Lee

That's a bit more efficient than what I was doing. Thanks! Unfortunately, my one (1) field is still not having its contents duplicated. I really think it has something to do with the field being a button. Can fields that are buttons only be duplicated with the duplicate record command (which is not useful in my situation).

Thanks for reading!

Attach a copy of your file so we can see your file and scripts. Be sure to delete sensitive data.

Lee

  • Author

In an attempt to clone the database and have it working for others to see, I found the cause of the problem. It turns out that someone who tried to do me a favor made the field I was having difficulty duplicating a field whose value was based upon a calculation. So I changed that and now life is good. Thanks for pointing me on the right track!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.