Hi there,
I have created a form which consist of a Grid and Inside this grid i have added one DateEdit Control with EDT = Transdate.
When i open the form, i need to fill the DateEdit Control field with today's date.Please help.
Thanks
Regards
*This post is locked for comments
If a control is bound to a datasource, trying to change its value directly has no effect. As I tried to explained, you have to change the value of the table field.
If you're using initValue() on the table (which should be your default choice), simply use this.DisplayDate = systemDateGet().
If it's logic specific to your form (and the field shouldn't be initialized to the current date in other situations), therefore you're forced to put your code on the form, use yourDataSourceName.DisplayDate = systemDateGet().
Thanks @Martin Dráb
thanks for you deep explanation, i have tried to write the code in initValue() method, but its not working for me.
public void initValue()
{
super();
om_displayDate_DisplayDate.dateValue(systemDateGet());
}
My data-source has three fields i.e. ItemID, StoreID, DisplayDate
and Grid already contains some records.
Grids are bound to a datasouce, therefore you need to initialize the table buffer and not the control itself. When you open the form, you have three options what may happen:
As you see, it's not really opening the form; it's about creating a new record in the datasource.
You can put such initializing logic into initValue() method. If records should always be initialized in this way, use initValue() on the table. If it's logic specific to this one form only (and shouldn't be used when new records are created in other forms), use initValue() on the datasource.
systemDateGet() will give you the current date.
Hi Mohammed Altaf ,
On the init method of a form after super() you can write
public void init() { super(); DateEdit.dateValue(systemDateGet()); }
where "DateEdit" is name of your control. Please note that you need to set "AutoDeclaration" property to "Yes" on this control.
Hi Mohammed,
init the field value by using today() function to assign the current date.
Thanks,
Muthusamy.V
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156