4 Replies Latest reply on Nov 28, 2013 3:58 PM by fmpro_novice

    Assigning numbers to records



      Assigning numbers to records


           Can someone tell me what a script would look like that would assign the following numbers to records? The first 20 records would be assigned numbers 1 through 20. Then, after 20, the numbers would be 1B, 10B, 2B, 11B, 3B, 12B, 4B, 13B, etc. The numbers would never go past 20.


        • 1. Re: Assigning numbers to records

               In my opinion this question is far too vague to warrant a reply that would help. Why would records 1-18 be assigned numbers 1-20?  I don't get the rest of the question. Typo?

          • 2. Re: Assigning numbers to records

                 Sorry, yes typo. Should say "records 1-20."  The script would loop through the records and at record 21, instead of assigning the number 21 to that record, the number would be 1B. Then, for record 22, the number would be 10B.

                 The list of records would look like this with the first number shown below being the one the script would add to the record as a field. The script would not create the field, just automatically fill it with the sequence shown.

                 1    Record One
                 2    Record Two
                 3    Record Three
                 4    Record Four
                 5    Record Five
                 6    Record Six
                 7    Record Seven
                 8     Record Eight
                 9     Record Nine
                 10   Record Ten
                 11   Record Eleven
                 12   Record Twelve
                 13   Record Thirteen
                 14   Record Fourteen
                 15   Record Fifteen
                 16   Record Sixteen
                 17    Record Seventeen
                 18    Record Eighteen
                 19    Record Nineteen
                 20    Record Twenty
                 1B     Record Twenty One
                 10B   Record Twenty Two
                 2B     Record Twenty Three
                 11B    Record Twenty Four
                 3B      Record Twenty Five
                 12B    Record Twenty Six
                 4B       Record Twenty Seven
                 13B     Record Twenty Eight

                 etc., the loop would normally not exceed 40 records, but if in the rare case it did, the next cycle would be 1C, 10C, 2C, 11C, 3C, 12C, etc.

            • 3. Re: Assigning numbers to records

                   What end user requirement is driving the need for this numbering? It can be done, but I wouldn't set something like this up without a specific reason for doing so.

                   I don't think you need a loop. Replace field contents with the calculation option can number an entire found set in one go:

                   Let ( R = Get ( RecordNumber ) ;
                            Case ( R < 21 ; R ;
                                         R < 41 ; R - 20 & "B" ;
                                         R - 40 & "C"
                                        ) // case
                          ) // let

              • 4. Re: Assigning numbers to records

                      Phil - You are one smart dude! Thank you for your time with this. Works fantastic!