Simplicty and flexibility!

How to limit the input in a subform to an exact number of records.

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

How to limit the input in a subform to an exact number of records.

Download Sample!

We solve this with new DE8 features.

A subform works as follows. If you fill all the visible rows in a subform it will move one up and give you a "clean" new row at the bottom. As long as there is a clean new row at the bottom it will not allow you to scroll further.

So our hack is simply to hide the row at the bottom so you won't be able to access it and hence to able to populate it. This will forestall DataEase's attempt to add a new row.

We do this by hiding the Record object in the subform for Row 14 (we wanted 13 row so we make a subform with 14 and hide the last).

in DE8 we have added the ability to pick which Object or Object Clone we want to manipulate in the form. All objects follow a strict object Hierarchy which is simply right to left, top to bottom inside a Container class.

This might be slightly complicated to get the hang of.

In a form without subforms, the object hierarchy will be straight forward left to right, top to bottom. A object all the way to the right which is one pixel higher than one all the way to the left will be ahead in the object order.

When you have a subform, the rules will be the same inside a subform. If you have two subforms next to each other on the same pixle line, the one to the left will be parsed first and then the one to the right. If the one to the right is one pixel or more higher up it will go first.

There is one "big" flaw in the DataEase object model and that is that all Record objects is called Record1 (actullay it is called Record on creation and magically renamed Record1 on first reload of the form....but that is another story). In all practical terms it is ALWAYS called Record1.

So if you have a MainForm with a Subform (like the sample) the first Record1 will be the main record and the second Record1 will be the first Record in the subform.

THis is why we in Manip hide Record1#15 and not Record1#14.

Have a look at the sample and see if you can figure it out.

Written by DataEase 03/11/15 at 11:41:36 Dataease [{8}]FIVE

Re:How to limit the input in a subform to an exact number of records.

This is perfect!

But, how do we handle if we have two sub-forms?

Written by Jeyarajah Arulrajah 04/11/15 at 00:51:48 Dataease [{8}]FIVE

Re:Re:How to limit the input in a subform to an exact number of records.

Hi Arul. 

It is all there in the first reply.... I guess you read to fast ;-)

1. Record object is always called Record1, and they cannot be renamed. The slight confusion is that when you create a form or a subsequent subform, the RECORD object is initially named Record...BUT! It will change name the first time you close and reload the document. Why? Only God knows, but it has been like this forever.

So for all practical programming reasons, you need to work with Record1 only!!!

So the RECORD object of the Main Form is Record1. Each clone of the Record object in a Subform is called Record1 and in any subsequent Subform.

Ex. If you have a form with 3 subforms, with 10, 15 and 20 rows, you will have 46 objects named Record1 in your form.

Lets for simplicity put the subforms under one another on the form. The the last Record object in each Subform would be


PS! If you move the subforms in the form so they change place in the object order, this will no longer apply!

2. All objects in DataEase Object model gets automatically named, but some objects can be renamed and some can't.

Forms, Record and TabControls cannot.

Form will be named Document Name.
Sumbforms will be named the same as the relationship they are created on.
Record will always be named Record1 (after first reload of document).
TablControls will always be named Tab Control but with a incremental number 

The best way to find the object names is in the OML editor. There you see the order and the names.

Written by DataEase 10/11/15 at 08:09:59 Dataease [{8}]FIVE