4 Replies Latest reply on May 7, 2012 8:05 PM by dperez@animas.net

# Fill and Increment every N records

### Title

Fill and Increment every N records

### Post

Hello,

I currently have an inventory of several thousand items.  When I collect these items for storage, I need to place 10 items into a box.  I want to be able to go to a specific box and know that I can find any one of the thousands of items is in a particular box.  What I'm trying to do, is basically give each box a location name such as A1, A2, A3 etc. where each box will have 10 items in each box with a serial number.  When I look up the serial number, I will then know which box to go to to find the item.  If I put all of the serial numbers in order, I want to be able to fill my Box location field with the Box location name, so I need to fill the first 10 records with A1, then increment the next 10 Records to A2, then the next 10 to A3, etc until I have all of the Serial number records allocated to a box location.  How would I go about doing that?  I've tried to figure out a way using the "Replace with Calculated Result" without success in FM v.9.  I figure there's got to be a way, but I just can't figure out the calculation.  Attached is a small example.  Any help is appreciated. Thank you.

• ###### 1. Re: Fill and Increment every N records

I think you'll need a looping script for this. Why does your box ID have a letter and a number? (what does the letter stand for?

• ###### 2. Re: Fill and Increment every N records

It doesn't need to. I just want to be able to identify a specific group and the box number.  I'm collecting equipment from students and the letter identifies the Grade level and the number identifies the Box. So If I've got 200 6th graders then the First set will be A1-A20. 7th grade will then start with B1-Bn and so on.

• ###### 3. Re: Fill and Increment every N records

A possible answer is found in the user of Mod and Div.

Mond is the remainer left after you divide a number by another number. Div is the number minus mod.

So Div(recordnumber + 10;10) would give you the box number. Something like:

1

1

1

1

1

1

1

1

1

1

2

2

2

2

2

2

2

2

2

2

etc.

Case(

Grade = 6 ; "A" ;

Grade = 7 ; "B" ;

etc

) & Div(recordnumber + 10;10)

Which Produces:

A1

A2

A3

...

B1

B2

• ###### 4. Re: Fill and Increment every N records

I Got it!  Thanks for the help.  This is the final script I used to generate the Box location ID.

Case(

grade_level = 6 ; "A" ;

grade_level = 7 ; "B" ;

grade_level = 8 ; "C" ;

) & Div(Get (recordnumber) + 9;10)

I have to run this on each grade level to keep the box numbers low, but this is going to be a huge time saver.

Thanks again.