6 Replies Latest reply on Apr 1, 2009 3:34 PM by TSGal

    Creating a new sale from contacts

    TenerifeB

      Title

      Creating a new sale from contacts

      Post

      VERY New to databases so can someone help!  I have contacts and sales related databases in FM10.  When I am in contacts, add the details I need, I created a button to "Create a New Sale" which does then open the sales database.  However, it is only ever creating a sale from the first record only and not subsequent ones.  Is this a table problem or scripting problem.  Would REALLY appreciate some help for a Newbie. :)

       

        • 1. Re: Creating a new sale from contacts
          philmodjunk
            

          TenerifeB wrote:

          VERY New to databases so can someone help!  I have contacts and sales related databases in FM10.  When I am in contacts, add the details I need, I created a button to "Create a New Sale" which does then open the sales database.  However, it is only ever creating a sale from the first record only and not subsequent ones.  Is this a table problem or scripting problem.  Would REALLY appreciate some help for a Newbie. :)

           


           

          Possibly both.

           

          Please describe your two tables, their relationships and any scripts you are using in more detail. Do you have two files with one table in each file or one file with two tables? Both options work, but one file/two tables is generally the simpler approach.


          • 2. Re: Creating a new sale from contacts
            TenerifeB
               Thank you so much for the reply.  I will do my best to describe what I have.

             

            I have adapted the Business Productivity Solution to suit what I needed and this script came from there in sales Orders. I changed the Set Field part to show Contract Nº.  The problem I now have is that I have changed so much, I can't go back to the beginning:(  This is the Scipt from Sales Orders.

             

            Allow User Abort [Off]

            Select Window [Current Window]

            Go To Layout["Form View" (Sales Orders)]

            New Record/Request

            Set Field [Sales Orders::Contract Nº:]

            Commit Records/Requests

            Adjust Window [Resize to Fit]

             

            The script that is in Contacts is:

            Set Field [Contacts::Contract Nº]

            Perform Script ["Create New Sale from Contacts" from file: "Sales Orders"]

             

            Think I've bitten off more than I can chew here.

            • 3. Re: Creating a new sale from contacts
              philmodjunk
                

               

              Think I've bitten off more than I can chew here.

               

              Which is why you posted to the forum to get some help with the chewing :smileywink:

               

              I have adapted the Business Productivity Solution to suit what I needed...

               

              Since I don't have the Business Productivity Solution, that doesn't tell me much. Other forum posters may be able to speak from their experience with this solution.

               

              ...and this script came from there in sales Orders. I changed the Set Field part to show Contract Nº. Allow User Abort [Off]

               

              Select Window [Current Window]

              Go To Layout["Form View" (Sales Orders)]

              New Record/Request

              Set Field [Sales Orders::Contract Nº:]

               

              Set Field normally has two parameters [TargetTable::TargetField, Expression whose value will be stored in target field]

              You appear to be missing the second parameter. The same part is missing from your second script.

               

              That could be the main problem.

               

              Generally key fields (such as Contract Nº) shouldn't need a specific set field type of action to assign explicit values to them. Instead, key fields normally are defined as Automatic serial numbers in the main table and linked to a matching, simple number field in the secondary table. The relationship linking these two tables is then defined to automatically create the matching value in the related table. Since this is a commercially distributed set of FMP database files, that's my best guess as to how your fields/tables/relationships are set up.

               

              Then you have a layout where fields from both main and secondary tables are displayed. When you create a new record in the Main table, the new record automatically assigns a new serial number value to its key field. When you start entering data in the related fields, the defined relationship automatically stores the matching serial number value in its key field.

               

              In order to make this work, you need correctly defined fields, relationships and layouts. Without my knowing more about what those are, it's difficult for me to be more specific, but perhaps other forum participants who are familiar with this solution can help.

               

              Here's a few suggestions to help you increase your understanding.

               

              Select Manage | Database | Relationships from the file menu.

              Examine the relationships linking various Table Instances and see if you can figure them out.

              Select the Fields tab in Manage | Database and check out the field definitions.

              Double-Click a field definition to examine the options that have been set for it (like autoenter serial number).

              Double click on the Relationship lines that link these tables and look at the options selected.

              Press F1 to bring up on line help and research key words where you have questions.

              Get a good book on how to use Filemaker

              Join a user group or find a local "expert" to help you out.

              Keep posting to this forum

               

              • 4. Re: Creating a new sale from contacts
                TSGal

                TenerifeB:

                 

                Thank you for your posts.

                 

                The advice from PhilModJunk is excellent (Thank you!).

                 

                I have access to the Business Productivity Solution, so if you want the script back to its original form, let me know which script it is and I'll post it here.  Otherwise, you're in good hands.

                 

                TSGal

                FileMaker, Inc. 

                • 5. Re: Creating a new sale from contacts
                  TenerifeB
                    

                  Thank you both for your help.  If I'm still stuck I will certainly keep in touch.  Please can you post the script for "Creating a new sale from Contacts" located in the Sales Invoices part of the BPS and also the script in Contacts for "create new sale".

                   

                  Thanks again for you quick response.

                   

                   

                  • 6. Re: Creating a new sale from contacts
                    TSGal

                    TenerifeB:

                     

                    Here is the original script steps for "Create New Sale From Contacts"

                     

                    Allow User Abort [Off]

                    Select Window [Current Window]

                    Go to Layout [ "Form View" (Sales Orders) ]

                    Show All Records

                    New Record/Request

                    Set Field [ Sales Orders:: Bill To Contact ID ; <Table Missing> :: <Field Missing> ]

                    Commit Records/Request [No Dialog]

                    Adjust Window [Resize to Fit]

                     

                    ===========

                     

                    Now, in the Set Field step, there should be a Table and Field, but I don't have all of the modules.  However, if you are familiar enough with the system,  you probably have an idea where the Contact ID information is coming from (Contacts file?).

                     

                    TSGal

                    FileMaker, Inc.