8 Replies Latest reply on Jun 24, 2010 5:22 AM by schnook

    Copy data in fields to other layout via script

    schnook

      Title

      Copy data in fields to other layout via script

      Post

      Hello all,

       

      We have a Radio log layout that boating members sign on to when they go out (fields like: vessel_reg, vessel_name, position, mobile phone, people on board, (overnight which is a value list of Yes and No) etc), each log is a new entry, we also have an overnight log (fields: vessel_reg, frequency, position, people on board, (cleared which is a value list of Yes and No) if they are staying out overnight. All in the same database. 

       

      What i need help with is this if a vessel is staying out overnight and the overnight drop down box = Yes i need the data that is entered in the fields in the Radio Log: frequency, vessel_reg, people on board, position, mobile phone and cleared fields to be entered in the overnight log.

       

      Hope this makes sense.

       

      We are using FMP Pro 11 with Win XP service Pk 3.

       

      Regards 

      schnook

        • 1. Re: Copy data in fields to other layout via script
          cuitw_1

          You can do it by simply using an auto enter in the overnight log,

           

          If ( vessel = overnight and overnight = yes ; radio::related_field ; self)

           

          You can also set it not to replace existing value (if any) if you want to keep existing data of the overnight table.

          • 2. Re: Copy data in fields to other layout via script
            LaRetta_1

            You should not need to duplicate information.  What fields are the same in both tables?  CustomerID and date maybe?  Join your tables by these two fields using = so it looks like:

             

            Radio Log::CustomerID = Overnight Log::CustomerID

            AND

            Radio Log::Date = Overnight Log::Date

             

            Below in the relationship graph, check 'allow creation of records' in the Overnight Log.

             

            From your Radio log, place your field from Overnight_dropdown box.  When you are in radio log and click YES in the Overnight field, it will create a new record in Overnight which will begin with the CustomerID and Date.  For other fields needed in the Overnight log, they probably aren't needed at all.  Simply grab your fields from Radio log and place them on your Overnight Log layout.

             

            I explained this pretty fast ... I have little time right now.  But I'm hoping this moves you forward.  If not, ask questions.

            • 3. Re: Copy data in fields to other layout via script
              schnook

              Thanks for the reply,

               

              I'll have a go with what you said and let you know how i went, thanks again.

               

              Regards

              schnook

              • 4. Re: Copy data in fields to other layout via script
                schnook

                Hello,

                 

                Am having trouble doing what was suggested it is bringing over all the radio log entries not just the overnight ones.

                What needs to happen is that only the logs that have overnight selected as yes from a drop down box with value list "yes" need to be entered in the overnight log.

                Is there a script trigger that can be used. Don't understand programming very much at all.

                 

                Regards

                schnook

                • 5. Re: Copy data in fields to other layout via script
                  schnook

                  Hello LaRetta,

                   

                  I am trying to copy and paste data from certain fields in one layout to other fields in a different Layout via a script trigger.

                   

                  Below is a script that i am trying to get to work, don't know if it's the wright way to do it or not, what it is doing so far is going to the Layout and creating a new record but it is not pasting the data into the fields.

                  Any help would be great.

                   

                  If [New Radio Log::Overnight = "YES"]

                  Copy [Select; New Radio Log::Frequency]

                  Copy [Select; New Radio Log::From]

                  Copy [Select; New Radio Log::Vessel Names]

                  Copy [Select; New Radio Log::Persons on Board]

                  Copy [Select; New Radio Log::Mobile Phone]

                  Copy [Select; New Radio Log::Position]

                  Go To Layout ["Overnight Log" (Overnight Log)]

                  New Record/Request

                  Paste [Overnight log::Frequency]

                  Paste [Overnight log::Vessel Registration]

                  Paste [Overnight log::Vessel Name]

                  Paste [Overnight log::POB]

                  Paste [Overnight log::Mobile Phone]

                  Paste [Overnight log::Position]

                  End If

                   

                  Regards

                  schnook

                  • 6. Re: Copy data in fields to other layout via script
                    LaRetta_1

                    Oh dear.  Do you know how to make a relationship in the graph?  You do not need script; but even if you did, you wouldn't want to use copy/paste - you would use Set Field[].

                     

                    If you re-read what I suggested, I suggested that you relate the two tables based upon what makes them common.  But it would be best if you could upload your file somewhere (like 4 shared) and then provide a ink.  I suspect that you are missing important tables to handle this properly but we surely can't advise without seeing what you have particularly since you are so new to this.

                    • 7. Re: Copy data in fields to other layout via script
                      schnook

                      Hi

                       

                      All i am getting is ? marks in the fields, i have made a relationship via the rego number but all i am getting are / marks. This one is way to hard for me to try and do. thanks for your time.

                       

                      Regards

                      schnook 

                      • 8. Re: Copy data in fields to other layout via script
                        schnook

                        Hi LaRetta

                         

                        I will create a blank database and upload it to 4shared in the next couple of day and send you the link, i would be interested in what you think of the database and if you could help me do what i an trying to do.

                        To tell ya the truth i don't realy know how i got most of the thing to work i must have totaly destroyed bout 40 databases getting it to where it is now. But all in all it is doing most of what we want it to do.

                         

                        Regards

                        schnook