Notifications
Announcements
No record found.
I have a form on which i place a simple button and on this button click i want to insert today date time with some text in table field.
I have written above code on button click override method but it is showing error, please can any one guide me ?
Hi itlabnarmi,
Can you tell what exact error message you get? Is the table in which you want to insert a record also a data source on the form?
I do assume you already get a build error as the TableName object is not a table. It is a string variable. If Mytable is a datasource on the form, you can use the next coding:
[Control("Button")] class AddReview { /// /// This method will add a review in Mytable /// public void clicked() { super(); ttsbegin; Mytable.review = 'Review completed on ' date2Str(DateTimeUtil::getSystemDateTime()); Mytable.insert(); ttscommit; } }
If the Mytable is not a datasource on the form, use the next coding where you declare the table variable.
[Control("Button")] class AddReview { /// /// This method will add a review in Mytable /// public void clicked() { Mytable mytable; super(); ttsbegin; mytable.review = 'Review completed on ' date2Str(DateTimeUtil::getSystemDateTime()); mytable.insert(); ttscommit; } }
Hi itlabnarmi_ivoruk
In addition to Andre comments, I guess error is due to date2str function.
date2tr function expects date time value but you are passing date value.
Make use of DateTimeUtil class to convert date to string like below.
MyTable.review = "Review completed on" DateTimeUtil::tostr(DateTimeUtil::getSystemDateTime());
Thanks,
Girish S.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 584 Most Valuable Professional
André Arnaud de Cal... 499 Super User 2025 Season 2
Sohaib Cheema 254 User Group Leader