1 2 Previous Next 20 Replies Latest reply on Dec 22, 2009 3:51 PM by schnook

    Script Help

    schnook

      Title

      Script Help

      Post

      Hello All,

       

      I need help in making a script that will only generate and enter a serial number when button print from is clicked on.

       

      What we have  is a vessel assist form layout that needs to only have a generated serial number entered in the Vessel Assist Activation Number field when the print form button on said layout is clicked.

       

      All other data is entered automatically from the radio log layout.

       

      I am using Filemaker Pro 10 Advanced with XP Pro service Pk 3, any help would be much appreciated, in dummy terms please. (step by step would be good) am a newbe trying to learn quick.

       

      Regards schnook

        • 1. Re: Script Help
          comment_1
            

          Do these numbers have to be consecutive and in chronological order? Suppose you auto-enter a serial number on creation, but "activate" it only when printed, e.g.:

          SerialID  Created            Printed             YourSerialNumber
          1         1/1/2009 00:01     1/1/2009 02:15      1
          2         1/1/2009 01:05     1/1/2009 01:30      2
          3         1/1/2009 02:30    
          4         1/1/2009 03:45     1/1/2009 03:55      4

           

          • 2. Re: Script Help
            schnook
              

            Hello comment,

             

            Not quite sure what you are saying, we just need the generated serial number to be only entered in the field upon clicking of the print from button. No date or time of printing is needed, and the number to go up by one each time the print form button is clicked.

             

            It may be 2, 3, or more days in between before we need to print this form out again. It is a Rescue Activation Number eg: 1701 means that this is the 1701 rescues we have activated. Hopes that helps.

             

            Regards schnook

            • 3. Re: Script Help
              RSchaub
                

              Print button =

               

              Print [ ]

              Set Field [Serial] [Max(Serai) +1 ]

               

               

              • 4. Re: Script Help
                comment_1
                   I am just trying to understand the situation a litttle better, because what you are asking for is not simple at all - it would be better to find some other arrangement. So please elaborate why the number should be assigned only when printed, why would these be printed out of order (or perhaps not at all?), and so on.
                • 5. Re: Script Help
                  schnook
                    

                  Hello commet,

                  We are a Volunteer Marine Rescue that assist vessels in distress, broken down or in danger of sinking etc. We have a Membership Database that is linked to our Radio Log Database the form when it get printed is given to our Rescue Boat Skipper, it containt information on the boat that needs our help. The activation number is a record number for that vessel and for us to know how many vessels we have assisted in total.

                   

                  Regards schnook

                   

                   

                  • 6. Re: Script Help
                    comment_1
                       I"m still not sure I understand this. It seems you should have three tables: Vessels, Log and Rescues. When an incident logged in the Log table requires a rescue activity, a new record should be created in the Rescues table. But that is just a guess, because I don't really understand your description.
                    • 7. Re: Script Help
                      philmodjunk
                         If you posted an example walking us through what you want to see happen, when and why, it might help to visualize the issue.
                      • 8. Re: Script Help
                        schnook
                          

                        Sorry if I am not explaining it properly I will start from the beginning.

                         

                        We have 2 Databases, 1st database is VMR Membership, it has 12 Layouts, it holds all the boat owners details, membership renewal forms, membership cards, address labels etc.

                         

                        2nd Database is the Radio Log, it has 7 layouts, Radio Calls, (boats that have logged on with us and where they are going for the day and when they are due back,) local weather, local tides, local radar, vessel assist, (the layout is only printed if a boat needs assistance)

                         

                        Now when we enter a new radio call that information is automatically entered into the Vessel Assist via fields like boat rego, member number, mobile phone, emergency contacts etc, if we have 15 radio log calls we will have 15 vessel assist logs.

                         

                        The Vessel Assist Activation Number needs to only be generated in the vessel assist activation number field on the Vessel Assist layout when we need to print out the Vessel Assist layout to give the rescue boat there details.

                         

                        The vessel assist activation number is a number that we share with the likes of the water police, search and rescue, ambulance and lets us keep a total of how many rescues we have made.

                         

                        Basically it is just a number that needs to be generated only when the layout is printed. 

                         

                        I hope this will clear up things.

                         

                        Regards schnook

                         

                        • 9. Re: Script Help
                          philmodjunk
                            

                          If I understand your last post, the "activation number" needs to be unique but it need not be sequential.

                           

                          In other words, if you generated 5 activation numbers in one day and they read like this:

                           

                          5432

                          5433

                          5438

                          5440

                          6563

                           

                          The numbers would be acceptable as long as there are no duplicates. If so, scroll back up to Comment's suggestion of setting up a serial number but keeping it hidden until a button is clicked to print out the report.

                           

                          If does not work for you tell us why.

                          • 10. Re: Script Help
                            schnook
                              

                            Hello PhilModJunk

                             

                            The thing is the numbers do need to be sequential

                             

                            Regards schnook

                            • 11. Re: Script Help
                              philmodjunk
                                

                              That's why I asked for clarification as your last post didn't make that completely clear. :smileywink:

                               

                              Here's a method I worked out with another poster:

                               

                              Define a new table, Activations, with two fields

                              AssistID (number)

                              Activation (auto-entered serial number)

                               

                              You should already have a serial ID number in you "Vessel Assist" Table. If not, create one. I'm making up table and field names here so be sure and substitute what actually exist in your tables:

                               

                              Make a relationship:

                              VesselAssists::AssistID = Activations::AssistID (enable allow creation of records... for the Activations table)

                               

                              Now, to assign a sequential activation number when a script (such as by clicking a print button) is performed, put the following single step in your script:

                               

                              Set Field [Activations::AssistID; VesselAssists::AssistID]

                               

                              Place the Activations::Activation field on your layout and you'll see a unique, sequential serial number appear in it the first time the above script step is performed.

                              • 12. Re: Script Help
                                schnook
                                • 13. Re: Script Help
                                  philmodjunk
                                    

                                  Let's start with a list of your actual tables and fields involved to make the example clearer.

                                   

                                  Can you provide me with the name of your table you base your Vessel Assist layout on?

                                   

                                  Do you have a serial ID number field in this table? If so, its name is...?

                                  • 14. Re: Script Help
                                    schnook
                                      

                                    Thanks for this PhilModJunk,

                                     

                                    The Layout is named: Vessel Assist (it is one of the layouts in the Radio Log Database)

                                     

                                    The field is named: Vessel Activation Number

                                     

                                    Regards schnook

                                    1 2 Previous Next