4 Replies Latest reply on Dec 17, 2013 7:18 AM by incybau

    Copy and Paste a Portal Row

    incybau

      Title

      Copy and Paste a Portal Row

      Post

           Hoping for help again here - I am trying to implement the method I saw on Dwayneright.com - old school method of copy and pasting portal rows.  (http://www.dwaynewright.com/filemaker-thoughts/2012/11/22/old-school-copy-and-paste-a-filemaker-portal-row-technique.html)

           In my portal though, I am copying 6 fields - I was able to copy the first three fields properly and the last field - I can't seem to get the 4th and 5th - coz I can't quite grasp the trim the and position part of the calculation - hoping someone can guide me on the  trim portion of the 4th and 5th data field:  this is what I have so far in my paste portal script:

           This sets the field for the 1st field properly:

             
      •           Left(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1))

           This sets the field for the 2nd field properly:

             
      •           Trim(Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1) +2; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 2) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-2))
            
           This sets the field for the 3rd field properly:
                  
      •                Trim(Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 2)+2; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 3) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-5))
      •      

           I can't seem to get the 4th right:

             
      •           Trim(Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 3) +3; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 4) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-6))

           I can't seem to get the 5th right:

             
      •           Trim( Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 4) +2; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 5) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-6))

           This sets the field for the 6th field properly (which I got purely by trial and error):

             
      •           Trim(Right(EstimatesAndInvoices::CopyPortal; Length(EstimatesAndInvoices::CopyPortal) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 4)-7))

           I know I should be trying to grasp the entire concept first but all the guides I read are based on single letter counts or numbers - I can't seem to relate this properly- hoping someone can tell me or guide me to an easy to understand explanation.

        • 1. Re: Copy and Paste a Portal Row
          incybau

          Reposting the calculation part so it's clearer:

          This sets the field for the 1st field properly:

                 
          •           Left(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1))
          •      
          •            

          This sets the field for the 2nd field properly:

                 
          •           Trim(Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1) +2; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 2) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-2))
                
          This sets the field for the 3rd field properly:
                
                      
          •                Trim(Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 2)+2; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 3) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-5))
          •           
          •                 
          •      

          I can't seem to get the 4th right:

                 
          •           Trim(Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 3) +3; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 4) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-6))
          •      
          •            

          I can't seem to get the 5th right:

                 
          •           Trim( Middle(EstimatesAndInvoices::CopyPortal; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 4) +2; Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 5) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 1)-6))
          •      
          •            

          This sets the field for the 6th field properly (which I got purely by trial and error):

                 
          •           Trim(Right(EstimatesAndInvoices::CopyPortal; Length(EstimatesAndInvoices::CopyPortal) - Position(EstimatesAndInvoices::CopyPortal; " | "; 1; 4)-7))
          •      
          •            
          • 2. Re: Copy and Paste a Portal Row
            philmodjunk

                 There's a "new school" method that can make your code much simpler. Use a return (¶) instead of the "pipe" (|) character to separate your values copied from fields. Then GetValue ( copyfield ; 1 ) will return the value of the first copied field and GetValue ( copyfield ; 2 ) will return the next.

            • 3. Re: Copy and Paste a Portal Row
              incybau

                   Wow! Thanks Phil!!! will try that out now!

              • 4. Re: Copy and Paste a Portal Row
                incybau

                     Perfect Phil Thank you!!!!!