KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The "Is new record" command
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: August 10, 2001

The command "Is new record" returns True when the table's current record is being created and has not yet been saved in the current process. This is the preferred way to test if you are about to display a newly created record or an existing record. For example, in an Input Form Method you can handle new or existing records:<

Case of
 : (Form event=On Load )
  If (Is new record([Table]))
   [Table]ID:=Sequence number([Table])
   [Table]DateCreated:=Current date
  Else


   ` do some other setup for existing recs
 End if

End case


Note: You can obtain the same information by using the older command "Record number", and by testing if it returns -3. However, you should use "Is new record" instead of "Record number" to ensure compatibility with future versions of 4th Dimension.<

Command Is new record

http://www.4D.com/ACIDOC/CMU/CMU00668.HTM/p>

Command Record number

http://www.4D.com/ACIDOC/CMU/CMU00243.HTM