10 Replies Latest reply on Jun 29, 2009 1:51 PM by philmodjunk

    I need a script plz

    lkn4atlantis

      Title

      I need a script plz

      Post

      First off, I'm still new to FM and using FMP5.

      Here's my situation. I have a template called Individual Customer, which gives me info about each customer; name, address, phone ect. I also want it to list the items they are renting. The list of possible rental items is approx 60, so i don't want it to list each item and then a 0 if they don't have any. (I do need it to list negative numbers tho). I have the information in a seperate FM file and also in the same FM file as the Individual Customer page. So, what script would I use to create a list that would only show what they are renting, and how many of that item. The file with the Indivudual Customer page is called "Customers Main" and the file with the list of the customers and what they are renting is called "totals".  Any help would be greatly appreciated. Thanks much - Amy

        • 1. Re: I need a script plz
          philmodjunk
            

          You should have a relationship defined linking your two files. How have you defined this?

           

          No script should be needed except maybe to perform a find to get the right found set in some cases.

           

          In your Customers Main file, you can create a layout that uses a portal to display all the matching records from totals for a given customer. This is a good layout for data entry.

           

          In your "totals" file, you can create a summary report with Fields from Customers Main in the header and the invidual items rented in the body. If you perform a find in the totals file or use go To related records from the customers main file, you can pull up the report for one specific customer. This is a good way to generate a printed report.

           

          Both methods require a defined relationship that links the two files. The portal approach requires the relationship to be defined in Customers Main and the Summary Report  approach requires that this relationship be defined in Totals.

          • 2. Re: I need a script plz
            lkn4atlantis
               So, do i have to create a relationship for each of the 60 or so items?
            • 3. Re: I need a script plz
              philmodjunk
                

              Nope. Just one relationship for each method.

               

              Let's say you have a serial id number field in customer main. Each customer then has their own unique ID number. Place a matching number field in the Totals file. For existing data, enter the matching number for each customer in Customer Main for the matching record in Totals. Open Customer Main and select File | Define Relationships and create a new relationship to "Totals" with the ID number fields in each file as the specified fields for the relationship. Click the Allow creation of related records option for this relationship. For new records, use the portal technique When you type in information on a blank line of the portal, the new record in Totals will automatically be created with a matching customer id value in its key field.

              • 4. Re: I need a script plz
                lkn4atlantis
                  

                Ok, I tried the portal idea and either I did it wrong or it didn't work right. It partly worked because it showed the number of items being rented for the first item. But, it listed it's quantity 3 times, also, how would I get it to list all the items that customer has? Would I have to create a portal for each item? If, so then wouldn't it show all the items and then 0 if they weren't listing any? Or show a blank? Thanks

                • 5. Re: I need a script plz
                  lkn4atlantis
                     I don't have a serial id number field tho. Each customer has a unique name tho. Do I need to create a field with a unique id for each customer?
                  • 6. Re: I need a script plz
                    philmodjunk
                      

                    As long as it's unique for each customer it will work. I try to avoid using names as names are subject to change and this messes up the data. (Companies and people change their names for a number of different reasons.)

                     

                    Make sure that you create your portal layout in Customers Main and that it refers to your records in totals. I'm assuming that your totals file has one record for each rental property.

                    • 7. Re: I need a script plz
                      lkn4atlantis
                        

                      So, do I create a portal for each item then?

                      • 8. Re: I need a script plz
                        philmodjunk
                          

                        No.

                         

                        If your data is in correct order and you've defined the relationship correctly, your portal should give you a scrolling window that lists all the matching records from the related file.

                        • 9. Re: I need a script plz
                          lkn4atlantis
                             I guess I don't understand then. What relationship do I create to use for the portal. Each item is a seperate field.
                          • 10. Re: I need a script plz
                            philmodjunk
                              

                            Each item should be a separate record in order for any of my suggestions to work for you. If I were you, I'd consider designing a new file, "Properties", and set it up so that one record describes each rental property. That approach will greatly simplify what you need to do to manage this data.

                             

                            You can then import data from the totals file into the new Properties table to split up the data into separate records. I can't give you the exact steps for this as I don't have a clear enough understanding of your Totals structure.

                             

                            You can look up both portals and Import Records in the on line help for more information which may help you out quite a bit.