erich.wanker Posted June 21, 2016 Posted June 21, 2016 Hy .. i want to add the day-name to a uniDBGrid-cell ... just show the value in the Grid .. NO CHANGE in the DB (field = date) STARTDATUM is the start date of the schedule procedure TERMINCalcFields(DataSet: TDataSet); var wochentag: string; datum: TDateTime; LongDayNames : array[1..7] of string; begin LongDayNames[1] := 'Sonntag'; LongDayNames[2] := 'Montag'; LongDayNames[3] := 'Dienstag'; LongDayNames[4] := 'Mittwoch'; LongDayNames[5] := 'Donnerstag'; LongDayNames[6] := 'Freitag'; LongDayNames[7] := 'Samstag'; datum :=Termin.FieldByName('STARTDATUM').AsDateTime; wochentag := LongDayNames[DayOfWeek(datum)]; Termin.FieldByName('STARTDATUM').asstring := wochentag+', '+datetostr(datum); end; ..but didn´t work ... How can i fix this .... ThanX Quote
mhmda Posted June 21, 2016 Posted June 21, 2016 Use field->GetText event: procedure TUniMainModule.QryDocinvestigationDoc_TimeGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin Text:=FormatDateTime('dd/MM/yyyy HH:mm',QryDocinvestigation.FieldByName('Doc_Time').AsDateTime); end; 1 Quote
erich.wanker Posted June 22, 2016 Author Posted June 22, 2016 ..perfect ... Thank you Nice greetings from gastein valley http://www.gasteinertal.com/webcam/badhofgastein/current/1200.jpg Quote
zilav Posted June 22, 2016 Posted June 22, 2016 You were reading from and writing to the same field STARTDATUM Create a new field of calculated type and save your changes there, don't forget to assign it to dbgrid column. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.