3 Replies Latest reply on Oct 5, 2009 8:18 AM by trialuser1111

    Script to copy text from a field into a generic text box not assigned to a field?

    trialuser1111

      Title

      Script to copy text from a field into a generic text box not assigned to a field?

      Post

      I need a little help with a script; I'm essentially trying to replicate the "paste values" function in Excel in FileMaker.  What I'd like to do is have a script that copies all the text from Field A for every found record in a set on Layout A, and pastes them into corresponding text boxes in Layout B that are not assigned to a field.  The text in Field A is a paragraph or so of descriptive text, and in Layout B, I'd like to let users customize that text before finalizing in a PDF, BUT I don't want to create another field for the text in Layout B because the customization would be specific to that user for that particular report and would never be needed again after PDF.

       

      My thinking is that I need to assign a variable to each Field A in a found set (and I'm still very new to variables, so I'm not sure if that's feasible or my best option), and then have the script paste that set of variables in order.  So if I have 3 found records in Layout A, starting the script will turn Field A (record 1) into the variable $Text1, Field A (record 2) into $Text2, Field A (record 3) into $Text3, and then in Layout B, I could paste $Text1 into record 1, $Text2 into record 2, and $Text3 into record 3.

       

      Also, I'm not sure if this matters, but I'd like to be able to specify where the text is located in the body so I can maintain my layout.

       

      Thanks 

        • 1. Re: Script to copy text from a field into a generic text box not assigned to a field?
          mrvodka
            

          What do you mean by each record on Layout B? You say that you dont want to use a field for Layout B. So I take that as you want to paste it into the layout itself. Well you cant fo that without changing the layout for every record. The layout displays the record info that is it. If you change the actual layout in layout mode itself, then it get changed for all. While we are on it, you would have to give layout edit write privs to your customer.

           

          Gathering the data from a field for a found set is not that difficult. You can use another with just that field, and then use a Copy All script step. However, that will kill your clipboard. You may want to look through using a variable. We can suggest ideas but I just dont follow.

           

          Please explain what you are trying to do.

           

          • 2. Re: Script to copy text from a field into a generic text box not assigned to a field?
            trialuser1111
              

            Layout B uses the List View, so there are multiple records visible in the layout.

             

            As for pasting the text, it had somehow escaped me that I would have to go into Layout mode and paste it into the layout itself.  I'm not sure that's the route I want to go (unless there's a way for users with data-entry only permission to use scripts that involve going into layout mode...)

             

            So how could I solve my problem using fields?   I don't want people to run into the trouble of overwriting another user's customized text.  It's possible (but not that likely) that two users may need to customize the same standard blurb at the same time (unless that can be avoided with some clever solution of duplicating records in a dummy table and deleting them later maybe?)

            • 3. Re: Script to copy text from a field into a generic text box not assigned to a field?
              trialuser1111
                

              OK, problem solved.  I created a new field in the table that Layout B is based on, and there's now an OnLayoutLoad script which sets that standard text as a variable and applies it to this new field.  Plus, I have the added bonus of being able to log/archive the customizations, which may come in handy down the road.