6 Replies Latest reply on Dec 1, 2015 7:22 PM by BruceRobertson

# auto-enter calculation base on a certain count

what i am trying to accomplish here is to have a certain field auto-enter a text value.  that text values are P1, P2, P3, and so on. so, for the first 18 records, the text value should auto-enter P1, the next 18 records (19-36) would be "P2.,"  and so on. as you can see, every increment of 18 records, the text value changes.

thank you and appreciate all your replies and assistance.

• ###### 1. Re: auto-enter calculation base on a certain count

1.  You can have the Auto-Enter Serial Number in the field definition include text.  In the "next value" box put P1.  Every record will then have the next numeric value prefaced with the P, eg. P1, P2, P3 and so forth.

2.  Not quite sure what you are meaning by the text value changing every 18 records?  Are records 19-36 meant to have the values from P2 to P37?

• ###### 2. Re: auto-enter calculation base on a certain count

Make an auto-enter number field starting at 18, then your text is calculated as

"P" & Div ( aen ; 18 ) & Case ( aen > 35 ; ".," )

• ###### 3. Re: auto-enter calculation base on a certain count

This should do it:

YourAutoenterField =

Let ( [

_count = ExecuteSQL ( "SELECT COUNT(*) FROM YourTable" ; "" ; "" )

; _n = Div ( _count - 1 ; 18 ) + 1

] ;

"P" & _n

)

• ###### 4. Re: auto-enter calculation base on a certain count

my apologies if i did not come across clearly in my explanation of what i wanted to accomplish.  what i was looking for was that records 1 thru 18 will have an auto-enter of P1; e.g., record 1 would have P1, record 2 would have P1, record 3 would have P1 until record 19 which would then begin a new value of P2. record 20 would be P2....and so on.

• ###### 5. Re: auto-enter calculation base on a certain count

okramis, this looks intresting...i'll give this a try

• ###### 6. Re: auto-enter calculation base on a certain count

What are you really trying to do?

Is this for printing? The page numbers will take care of themselves.

Will the data every be in some other order, some records omitted?

Sound like another instance of the XY problem.

http://xyproblem.info/