|
|
Re: Restrict number of record in Form6i [message #637530 is a reply to message #637517] |
Tue, 19 May 2015 12:07 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
As it is possible to enter records anywhere in a multi record block (not only as the last record), you'll have to check how many records you already have (such as by navigating to the LAST_RECORD and checking value of the :SYSTEM.CURSOR_RECORD (review what other SYSTEM variable do as well!)) and forbid creating a record if total number of record exceeds 12.
Now, that's somewhat "stupid" as it will prevent entering more than 12 records in that block. What does it, really, mean? Do you not want to have more than 12 records in the whole table? Or more than 12 records per CLIENT_ID? Or more than 12 records per DATE_COLUMN value? Or ...? Got the point?
Therefore, if you could describe what problem you are trying to solve, someone might suggest a solution you'd be satisfied with.
[EDIT] Typo
[Updated on: Wed, 20 May 2015 00:07] Report message to a moderator
|
|
|
|
Re: Restrict number of record in Form6i [message #637559 is a reply to message #637530] |
Wed, 20 May 2015 03:27 |
amit_garg3
Messages: 22 Registered: January 2006 Location: bangalore
|
Junior Member |
|
|
Hi
Block have 5 different column. Value's are insert for One month at a time.Month are coming automatically ie total 12 record. I do not want user insert it for 13. Right now I am using when :system.last_record, when value >12, it's goes to first record. Is there any other way to do that?
|
|
|
|
Re: Restrict number of record in Form6i [message #637597 is a reply to message #637562] |
Wed, 20 May 2015 09:44 |
|
CraigB
Messages: 386 Registered: August 2014 Location: Utah, USA
|
Senior Member |
|
|
Quote:If it's for a given set of 12 months why not just pre-populate the records with the required months and not allow insert at all?
Agreed, this is a better approach. An alternative would also be to create a Unique Key on the table by YEAR and MONTH and then add a Check Constraint that does not allow a MONTH value > 12. This will prevent duplicate months for a given year and also prevent the insert of the month=13. Either approach would work.
Craig...
|
|
|