11 Replies Latest reply on May 24, 2012 3:32 AM by moj6054

    Product Code

    moj6054

      Hi,

      I have a problem with auto code for product in subcategory.

      Please see my attach database, My problem is:for first of record in each category , can't take a code and code start of second record.

      how I can do this?

      I want product take auto code according category code and unit of record in category.

        • 1. Re: Product Code
          BruceHerbach

          HI,

           

          Ok.. I wasn't quite sure what you were looking for.. As in Count of number of Product records or a total of the amount of product.  So in the attached version I gave you both.  Modified your Count field and added a sum field in the Category table.

           

          To make it easier for me,  I modifed the portal to show productID and added labels to the columns.

           

          HTH

          Bruce

          • 2. Re: Product Code
            moj6054

            thak you for answer,

            But,

            I need to add code for each product according category's group. I mean, when a record in Board category, count how much reacord added to this category and then a code add to this record . for sample if board id = 200 , and have 3 product add to this portal , then i add new record, the new code = 2004. and so for other category.

            • 3. Re: Product Code
              moj6054

              Hi, again, Please see this attach file, My problem is for first record in each portal , why for first record my calculation not happend?

              thank you.

              • 4. Re: Product Code
                BruceHerbach

                Hi,

                 

                To resolve this I did two things.

                First, for the Count function to work it the field you are counting has to have data in it.  If it is empty it won't be counted.  So in the attached version I changed the formula to count the Product::ProductID field. This field is automaticly populated as soon as you enter information into a new record in the portal and will always be populated.

                 

                Secondm  Uncheck the Calculation Option "Do Not evaluate if all fields are empty"  This forces it to do the count even if the field is empty.  So when you create a new record in the Category table the field resolves to 0 and when you add a record in the portal it goes to 1.

                 

                HTH

                Bruce

                • 5. Re: Product Code
                  moj6054

                  Thank u ver much,

                  If I want ,first record start with1 not zero, What I should do?

                  • 6. Re: Product Code
                    BruceHerbach

                    Hi,

                     

                    When you create the Category record there are no records in the Product table.  So at this point the Count is 0.  Once you enter data in one of the Product fields in the portal,  FileMaker creates the first Product record.  At this point the Count goes to 1.

                     

                    In short the first record is 1,  you just have to create it. 

                    HTH
                    Bruce

                    • 7. Re: Product Code
                      moj6054

                      Can do this with a script?

                      Can design a script, when choose a category (like board), go to this category count record and then enter code for new record?

                      • 8. Re: Product Code
                        beverly

                        If you can manually preform a series of steps to do this, you can write a script to do the same things. You can call the script with a button click or "trigger" automatically based on various changes to field(s) and/or other conditions.

                         

                        Beverly

                        • 9. Re: Product Code
                          moj6054

                          Can u help me for write this script?

                          • 10. Re: Product Code
                            beverly

                            Can you write the manual steps you are taking? That's how I begin all scripts. Then I fill in with the necessary script steps and functions.

                             

                            Beverly

                            • 11. Re: Product Code
                              moj6054

                              I have a Group Table in in this table have some record (Board,CT,Cable ,....) and each record have some ID like (200;210;220;....)

                              and a product table, two table linke with category:categoryID ----- product::categoryID

                               

                              in product table when I want add new record first choose category (example Board) and then add product description (example PWM), Qty (10) price (15$) and....

                              Now I want a script do this:

                              when I choose category, go to category board and how many record i add before (example 5) and then create a new code for this last record some code like:2006 ( is 6 record in this group)

                              and again for new record in CT group     :2101(1 for first record in this group and for second 2102 and ...)

                                                                   in Cable group :2201

                               

                               

                               

                              for add each recotd in each group , add new code for last product

                              thank you for your help.

                              i use this database for my stock, and I want to add code for product in each group.