8 Replies Latest reply on Aug 12, 2015 8:22 AM by JamesDiPaoloSmith

    How to copy text in a merge field?

    JamesDiPaoloSmith

      Title

      How to copy text in a merge field?

      Post

      I'm trying to figure out how to copy text inside a merge field. I've already written the preset text and the field designations, however I've noticed that I am unable to copy the text. I work at an engineering firm, and we'd like to use a set of checkboxes to input variables in order to generate an engineering report. All I need to do now is figure out how to copy the text to another program in order to write the rest of the report. Is there a script that will allow me to copy text within a merge field? 

        • 1. Re: How to copy text in a merge field?
          SteveMartino

          Can you be a little more specific?

          1.  Copy how?  Is the merge field just the field, or is there something else in the merge field.

          2.  Copy where?  How does copying the merge field integrate with:

          ...we'd like to use a set of checkboxes to input variables in order to generate an engineering report.

          3.  What other program?

          2 ways.  Put the actual field back on the layout.  It can be off to the side and out of view.  If it's a list view it will need to be lined up with the record.

          Use a simple script:

          Easiest-not always recommended:

          Copy [Select;YourTable::YourField] //puts in on the clipboard, destroying whatever was on the clipboard, and most likely leaving it on the clipboard, which is usually not recommended.

          Now you can paste this into another program like Word or Excel

          Better:

          Set Variable [$a; Value: YourTable::YourField]

          Then you can go to another layout, or where ever you need to go and use set field to 'paste' the value.

          If you need to do this on multiple records, you can enclose it in a loop

          • 2. Re: How to copy text in a merge field?
            JamesDiPaoloSmith

            Okay. Well the merge field is simply a text box with a link to the field from which I want to obtain information. I've created a text box where I have written "this building is an example of <<Project::ProjectNature>>" where I reference the ProjectNature field in the Projects table. In this table, I have assigned a value list to the ProjectNature field for employees to pick from. For example, I've created values like "fire damage" and "water damage" for employees to pick from a radio box selection. Once I input data into the field in browse mode, which I would do by checking one of the radio boxes, Filemaker automatically replaces the link text with the inputted value so that the text box reads "this building is an example of fire damage" or "water damage". From that point on I'd like to copy and paste the text that's been generated from Filemaker into Pages so that we can continue to write the rest of the report. This would allow us to bypass re-writing a lot of basic text describing the building in question by simply checking a few check boxes. However Filemaker does not allow me to select the text box to edit, copy or even export as a PDF. This is where I'm stuck. Can I edit the text box/merge field in order to copy the text in browse mode, or is there another way for me to recreate the same checkbox-merge field effect without actually using merge fields?

            • 3. Re: How to copy text in a merge field?
              SteveMartino

              Take a look at my last post.  I edited it, probably why you were typing.  But put the same field on the layout, but off to the side where you wont see it in browse mode.  Then a simple script  with one script step Copy will put it on the clipboard.  You can also use this hidden field with Set Variable, or Export Field Contents.

              • 4. Re: How to copy text in a merge field?
                philmodjunk

                The merge field isn't a text box. It's a merge field. Just as you manually can't copy from a merge field a script cannot copy from it either.

                But you can put a regular copy of this field on your layout off to the right, off the edge of the layout and then the copy script step will copy this value to the clip board so that you can paste it into other software.

                Just don't use copy/paste within FileMaker as there are better options that will leave the clipboard unmodified--which is nicer for your users.

                • 5. Re: How to copy text in a merge field?
                  schamblee

                  If you could select the text then it would no longer be a merge field, It would be a normal field.  If you combine this information in a calculation field then place the calculation field on the layout, then this field could be copied.  Calculation field are not modifiable.

                  • 6. Re: How to copy text in a merge field?
                    JamesDiPaoloSmith

                    Is there anyway that I can copy both the value and the preset text around the value, all in browse mode? Copying the value works only if I wanted the value, however we'd like to just copy the whole block of text once the variable has been defined. 

                    And if I use a calculation field instead of a merge field then would I still be able to write preset text in which the variable is enclosed in, and then define the variable so that everything can be copied at once? 

                    • 7. Re: How to copy text in a merge field?
                      philmodjunk

                      When using a calculation field, you'd still modify the original field that is referenced by the calculation field to change it's value.

                      You cannot copy layout text--such as a field object's label while in browse mode. Here's a script, however, that would work around this:

                      Put a text field on your layout. It can be hidden off the edge of the layout as previously recommended.

                      Perform this script:

                      Set Field [YourTable::HiddenTextField ; "Label Text Goes Here: " & Table::fieldToCopyFromHere ]
                      Copy [Select ; YourTable::HiddenTextField ]

                      • 8. Re: How to copy text in a merge field?
                        JamesDiPaoloSmith

                        That actually works perfectly. If I just set label text in the calculation field then all I have to do is copy it out once the values have been defined. Now I'm able to copy and paste everything. Thanks guys!