![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Sat, Jan 20 2018 1:38 PM | Permanent Link |
Anthony | I'm converting and existing Delphi app with EDB database to EWB, I have a timestamp field and use a datetimeedit control in Delphi. What would be the preferred way of implementing this in EWB and allowing the user to edit both the date and time elements? The dateedit control displays a runtime error representing the time portion of this field.
|
Sun, Jan 21 2018 3:33 AM | Permanent Link |
Uli Becker | Anthony,
> I'm converting and existing Delphi app with EDB database to EWB, I have a timestamp field and use a datetimeedit control in Delphi. What would be the preferred way of implementing this in EWB and allowing the user to edit both the date and time elements? The dateedit control displays a runtime error representing the time portion of this field. Maybe there is a better solution, but you can split date and time and display them in separate controls like this: procedure TForm1.Button1Click(Sender: TObject); begin comboDate.text := DateToStr(Now); edTime.Text := TimeToStr(Now); end; After editing you have to compose date and time to a timestamp: procedure TForm1.Button2Click(Sender: TObject); var TempTimeStamp: DateTime; begin TempTimeStamp := StrToDateTime(comboDate.text + ' ' + edTime.Text); edResult.Text := DateTimeToStr(TempTimeStamp); end; Uli |
Tue, Jan 23 2018 2:12 PM | Permanent Link |
Anthony | Uli Becker wrote:
> edResult.Text := DateTimeToStr(TempTimeStamp); Thanks Uli, I have tried your recomendation but currently have the controls on the form linked to dataset and datacolumn within the IDE to populate and update an EDB database. Is it possible to intercepts the commits to the database using your method of editing separately as date and time and then combining both edit to a datetime field? |
Tue, Jan 23 2018 10:51 PM | Permanent Link |
Richard Harding Wise Nutrition Coaching | Hi Anthony
Try something like this. Form with 'edEndDate', 'edEndTime' to be combined into DB column 'EndTimeStamp' --------------------------------------------------------------------------------------------------------------------- procedure TForm1.Form1Show(Sender: TObject); begin FormatSettings.ShortDateFormat := 'dd/MM/yyyy'; FormatSettings.ShortTimeFormat := 'HH:mm:ss'; <more stuff> end; // On exit for edEndDate & edEndTime procedure TForm1.edEndDateExit(Sender: TObject); var s: string; begin if not ((Contacts.State = dsInsert) or (Contacts.State = dsUpdate)) then begin Contacts.Update; end; s:= edEndDate.text + ' ' + edEndTime.Text; Contacts.Columns['EndTimestamp'].AsDateTime := StrToDateTime(s); end; // Separate Timestamp into date and time fields procedure TForm1.ContactsAfterScroll(Sender: TObject); begin edEndDate.Text := DateToStr(Contacts.Columns['EndTimestamp'].AsDate, true); edEndTime.Text := TimeToStr(Contacts.Columns['EndTimestamp'].AsTime, true); end; // Separate Timestamp into date and time fields procedure TForm1.ContactsAfterLoad(Sender: TObject); begin edEndDate.Text := DateToStr(Contacts.Columns['EndTimestamp'].AsDate, true); edEndTime.Text := TimeToStr(Contacts.Columns['EndTimestamp'].AsTime, true); end; Richard |
Fri, Jan 26 2018 12:46 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Anthony,
<< I'm converting and existing Delphi app with EDB database to EWB, I have a timestamp field and use a datetimeedit control in Delphi. What would be the preferred way of implementing this in EWB and allowing the user to edit both the date and time elements? The dateedit control displays a runtime error representing the time portion of this field. >> I would define two new columns in your EWB dataset, and use the dataset's AfterLoad event handler to populate them with the split data from the one timestamp column in the source EDB database. Then, make sure to also use the dataset AfterInsert and AfterUpdate event handlers to re-populate the timestamp column from the separate columns. Note: this only works with EDB and DBISAM databases on the back-end EWB web server. They are able to ignore invalid columns that are sent over with commits, whereas the ADO database functionality uses SQL and doesn't check to see if a column exists before building the insert/update statements. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, November 29, 2023 at 09:43 PM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |