Jump to content

Copying several fields at the same time


ChangeAgent
 Share

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

Recommended Posts

FMP V6.04

I like to create a button that by clicking it would copy 8 fields (all address details of a client) so I can paste it in to another document.

I am not sure how to go about this.

Do I need to write a script, and if so does anybody have a sample as I am not sure how to go about it.

Alternatively I can think of creating a layout like an envelope and copy it from there. However I ma not sure ho to do this either so I do not have to leave the record in order to do this. In other words I would like a user to only have to click one button to perform the whole copy routine.

Thanks for your help

Link to comment
Share on other sites

You can create a calculation field that formats the fields the way that you want them to be formmatted (order, carriage returns, spacing, etc). Then attach a script to your button that basically copies the field.

However, this will mean that you will have to have that field on a layout. So if you do not want it on your main layout, you can script it so that it goes to a layout where it does exist, and then goes back to your original layout.

Link to comment
Share on other sites

You can also place the field on the layout and turn off entry (Field Control > Behavior). Then resize it to 1 px by 1 px. It will disappear. Then, to remember where it is, place it underneath the button itself (Arrange > Send To Back). Then group them. Include a Commit Records/Requests at the end of the copy script and you're in biz. You won't notice it there at all. I help myself remember there are hidden objects under a button by placing a small jewel (bullet) on the button. :wink2:

It saves creating another layout but many times we have a Developer layout we can use anyway. Six of one; half dozen ...

Link to comment
Share on other sites

Include a Commit Records/Requests at the end of the copy script and you're in biz.

Hi LaRetta, he is using FM6. No Commit Step. Just didnt want to confuse him.

I figured since I am up anyway waiting for my plane, I might as well post. ???

Link to comment
Share on other sites

Dear LaRetta,

I was shocked to see these words come off your fingers: :shocked:

You can also place the field on the layout and turn off entry (Field Control > Behavior). Then resize it to 1 px by 1 px. It will disappear. Then, to remember where it is, place it underneath the button itself (Arrange > Send To Back). Then group them. Include a Commit Records/Requests at the end of the copy script and you're in biz. You won't notice it there at all. I help myself remember there are hidden objects under a button by placing a small jewel (bullet) on the button. :wink2:

It saves creating another layout but many times we have a Developer layout we can use anyway. Six of one; half dozen ...

I would have to disagree with the practice of putting hidden fields on the layout to assist with scripting. In addition to being messy to troubleshoot the script, it can cause odd flashes of data when the script is doing something to those fields, and it makes it a real pain to try to clean out detritus later. Besides, the interface is no place to leave your developer garbage.

I strongly recommend sticking with developer layouts instead for this sort of thing. If all the fields are there, it's very simple to switch to the developer layout, then back with a Go to Layout [original layout].

Now whack those finger with a ruler for me and tell them never to do it again. And I don't want to hear excuses about how you need them later for some piano recital.

Link to comment
Share on other sites

Nope, Mike, I won't whack my fingers at all. :wink2:

A good Developer keeps ALL tricks within their toolkit and this was presented as another alternative. Do I use it all the time? Heck no and I should have said it's not the preferred method when layout switch is possible. But it DOES exist in a a handful of places in my db. There have been more than a few posts over the past four years where this technique was the ONLY answer. I get NO flash when the field is used and I'm on Windows and I have biblical relationship with flash.

I learned field hiding right here on Forums, presented by CobaltSky to solve a problem (when the field HAD to be on a layout but be invisible). Knowing that one CAN have a field on a layout (for whatever purpose) but choose NOT to display it is a valuable tool. We used to have to hid the field but the new FM rendering makes it disappear at 1 px. It can be used to provide a tab 'landing zone' when using popups; it can be used to pop open large text fields (that you would otherwise want hidden) - they act as spoilers and work a treat. And how do you feel about placing a transparent rectangle at the right bottom edge of a layout for restricting window resize? Those with vs. 6 don't have windowing controls. Is that leaving Developer garbage on a layout? Or how about stacking popups?

I couldn't whack my fingers! I don't need for piano but my guitar-pickin' would take a nose dive! I refuse to get in mind-set of only using SOME of the tools we know about. That was the purpose of my post. That, and I was a bit bored last night. :crazy2:

Oh, and thanks for the catch, John. Then step would be Exit Record/Request, of course. :wink2:

LaRetta

Link to comment
Share on other sites

Thanks Vodka,

Sorry for being such a novice, but I do not understand the instructions.

I know how to create a calculation field, but I do not get it formatted. All the selected fields show up in a row when I paste them, and I like some of them to show up with spaces in between and some of them on separate lines. How to proceed? I tried everything but no cigar.

Thanks

Link to comment
Share on other sites

You can also place the field on the layout and turn off entry (Field Control > Behavior).

Thanks Vodka,

but how do I get it to display returns and spaces? I am breaking my head here without any results. cannot find it in the manuals and getting desperate.

thanks and enjoy your Hogmanay

Link to comment
Share on other sites

I don't know your field names etc but take a look at this:

[color:green]Name & "¶" &

Case ( not IsEmpty ( Address1 ) , Address1 & "¶" ) &

Case ( not IsEmpty ( Address2 ) , Address2 & "¶" ) &

City & ", " & State & " " & Zip

Result should be text. Then copy this calculation [color:red]FIELD onto clipboard.

Edited by Guest
Added red to clarify
Link to comment
Share on other sites

Thanks LaRetta

Your sample script helped me to solve this (to see my mistake in the script and learn how to do it) and it functions flawless. I decided to put the field on a separate layout and make the layout not visible in browse mode.

again thank you (and all others) for taking the time to help me do this, it is really appreciated.

Link to comment
Share on other sites

This topic is 5754 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
 Share

×
×
  • Create New...

Important Information

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