9 Replies Latest reply on May 23, 2014 6:46 AM by samarthmkt

    Regarding creating auto increment no in child records of parent table

    samarthmkt

      Title

      Regarding creating auto increment no in child records of parent table

      Post

           Dear Sir,

                   I want to create a child records of auto increment nos. in a particular column in Parent table. What will be the script value for this.

           Thanking you

            

      Est4.PNG

        • 1. Re: Regarding creating auto increment no in child records of parent table
          philmodjunk

               If you mean that you want the S No. field shown in the portal to automatically receive a different serial number value for each record thus created in the portal's table, you do not need a script. you simply define that field to auto-enter a serial number in Field Options.

          • 2. Re: Regarding creating auto increment no in child records of parent table
            samarthmkt

                 Thanks

                 Yet I have define from auto enter serial no. it works but the problem is when I go for new record then in S.No. column the no starts from last no completed of previous record. I want the no. should be start from 1 for every new record. Thanks

            • 3. Re: Regarding creating auto increment no in child records of parent table
              philmodjunk

                   and how will you use the value in this column? (Some possible options aren't the best choice in every situation)

              • 4. Re: Regarding creating auto increment no in child records of parent table
                samarthmkt

                     Thanks

                       I am giving you two pictures of different record establish in Estimate Table.In first record whose quote no is 26 in which in serial no column I applied auto serial no in value list of S.No. and I get No.1 2 3 accordingly line items. Ok when I prepare another new record in Estimate table of quote no. 28 and I get no. starts from 5 6 7 accordingly line items. I want the new record would also be start from 1 2 3 accordingly line items.

                • 6. Re: Regarding creating auto increment no in child records of parent table
                  philmodjunk

                       Sorry, but that does not answer my question. I can see that you want to number each line item in the portal sequentially starting with 1 for the first portal row. But once you have a number in this field, how else will you be using this number in this field?

                       If you only want to number the rows sequentially for display purposes, this can be done without using any field at all. But if you need to export an actual value from this field or use it in scripts or calculations, then that approach will not work.

                       And here's a related question. Say you create 5 records in this portal, then realize that you made a mistake and delete the 3rd record listed in the portal, what changes, if any, should take place in this field?

                  • 7. Re: Regarding creating auto increment no in child records of parent table
                    samarthmkt

                         Thanks

                         Yes I only need to display the numbers sequent for display purpose and while sending the portal to the customer should appear in the same way what we see in preview.

                          

                    • 8. Re: Regarding creating auto increment no in child records of parent table
                      philmodjunk

                           Then you can:

                             
                      1.           enter layout mode
                      2.      
                      3.           Select the text tool and draw a small rectangle on a blank area of your layout.
                      4.      
                      5.           Pull down the Insert menu and select the Record Number symbol.
                                   

                           If you are using FileMaker 12 or newer, this places the layout text: {{RecordNumber}} on your layout. Earlier versions put @@ on your layout.

                           This text will display as the current record number when you view the layout in Browse mode. If you place this text inside the portal row, it will number your portal rows starting with 1 for the first row.

                           But in FileMaker 12 and newer, this can be a bit tricky to make it work perfectly. The layout text, which now takes up a lot more space, must fit completely within the portal row and the portal must "own" the object. You can drag to position the text completely inside the portal row, but then move the portal a small distance to make sure that this text moves when the portal is moved. Once that works, you can use the arrow keys to adjust its position. You can also use the alignment tools inside the inspector to fine tune the object's position, but only after it is correctly "owned" by the portal. If you use the alignment tools to move the object from outside the portal into the portal row, it won't be owned by the portal.

                           It's OK if the text overlaps fields inside the portal next to it, this won't cause a problem in Browse mode, but can be a problem when working with the design of your portal in Layout Mode. One trick is to select all the text of this layout object from the second { to the first } and give it a very small font size. The formatting applied to the outer pair of {} will control how the number is displayed when the layout is in Browse mode so this shrinks down the space taken up without affecting the number's appearance.