erich.wanker Posted June 21, 2016 Share 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 Link to comment Share on other sites More sharing options...
mhmda Posted June 21, 2016 Share 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 Link to comment Share on other sites More sharing options...
erich.wanker Posted June 22, 2016 Author Share Posted June 22, 2016 ..perfect ... Thank you Nice greetings from gastein valley http://www.gasteinertal.com/webcam/badhofgastein/current/1200.jpg Quote Link to comment Share on other sites More sharing options...
mhmda Posted June 22, 2016 Share Posted June 22, 2016 You welcome... Quote Link to comment Share on other sites More sharing options...
zilav Posted June 22, 2016 Share 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 Link to comment Share on other sites More sharing options...
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.