Easy to Create, Easy to Change - Easy to use!


DatePicker() in subforms...?


Started by Arul
Search
You will need to Sign In to be able to add or comment on the forum!

DatePicker() in subforms...?

Here is a challenge for you. See the attached image.

How do we use datepicker for each row ?

................................................................................. ............................................................................. ................................................................


Written by Arul 24/07/13 at 09:51:54 Dataease [{8}]FIVE

Re:DatePicker() in subforms...?

Download Sample


The best way of doing this is by building our own "control". in DE8 you can manipulate objects by number. i SetValue("DateField") will set the value in the first DateField in the

form. In subforms DE clones the initial objects so all objects have the same name in each record, to work around this we have added a number option to the

Set functions i.e. SetValue("DateField#10",datepicker()) will set the date in the 10th datefield on the form.

One important thing to realise when manipulating objects is that they are only hosts for data, they are not linked to the data in records. The same way a Form is the same for

all records in the the table, the 10 subform records are host for any number of subrecords, so to link or DatePicker logic to the record is no good.

But do we have to bother with it at all? No. We do all this subform stuff because we want the data to be stored in flat structure, but the forms don't have to reflect this. This is 

actually a perfect occasion to show how Form logic can be forged to work with data logic.

Above I have simply made one button for each row in the Subform, made the subform transparent and put the buttons under the subform so they look like they are part of

the subform. Each button manipulate a DataField object from 1 to 10. ex. 

SetValue("DateField#5",DatePicker()) as an action on the button.

The brilliance of this is that it will always manipulate the field next to it, so when you scroll up and down in the subform it will still work.

COOL!


Written by DataEase 24/07/13 at 13:42:14 Dataease [{8}]FIVE