1 (edited by v_pozidis 2023-05-23 15:47:15)

Topic: Time in Agenda

Hi to all, I like to create an agenda giving the date choosing from the Calendar and it should  show in a tablegrid the time something like in the picture., so I can write the reason of the meeting. I have searched in the forum for calendars and found two, but the script is very difficult to understand.
Thank you in advance

https://i.ibb.co/W6tjvZV/time.png

Re: Time in Agenda

https://fileworld.pavlenkovv.ru/img/2023-05-26_23-11-44.png

Post's attachments

Attachment icon test.rar 8.28 kb, 93 downloads since 2023-05-26 

Re: Time in Agenda

Hi all,
Vladimir, when I see what you and others can do, I am amazed.

4 (edited by sparrow 2023-05-26 20:40:23)

Re: Time in Agenda

It will be easier. You can change the start time and easily transform into a step of 30 minutes.


 // заполняем таблицы списком времени
// for i := 7 to 23 do
// begin
//   if (i < 10) then n:='0'+IntToStr(i)+':00' else n:=IntToStr(i)+':00';
//   Form1.TableGrid1.AddRow(1);
//   if (i < 10) then Form1.TableGrid1.Cells[0,Form1.TableGrid1.RowCount-1] := '0'+IntToStr(i)+':00' else
//   Form1.TableGrid1.Cells[0,Form1.TableGrid1.RowCount-1] := IntToStr(i)+':00';
// end;
// for i := 0 to 6 do
// begin
//   n:='0'+IntToStr(i)+':00';
//   Form1.TableGrid1.AddRow(1);
//   Form1.TableGrid1.Cells[0,Form1.TableGrid1.RowCount-1] := n;
// end;

 Form1.TableGrid1.dbSQL := 'WITH RECURSIVE hour(x) AS ( '+
     'SELECT STRFTIME(''%H:%M'', ''2000-01-01 07:00:00'') UNION ALL '+
     'SELECT STRFTIME(''%H:%M'', x, ''+1 hours'') FROM hour '+
     'LIMIT 24) SELECT x as time , '' '' as Meeting FROM hour;';
Form1.TableGrid1.dbSQLExecute;

Re: Time in Agenda

sparrow wrote:

It will be easier. You can change the start time and easily transform into a step of 30 minutes.


 Form1.TableGrid1.dbSQL := 'WITH RECURSIVE hour(x) AS ( '+
     'SELECT STRFTIME(''%H:%M'', ''2000-01-01 07:00:00'') UNION ALL '+
     'SELECT STRFTIME(''%H:%M'', x, ''+1 hours'') FROM hour '+
     'LIMIT 24) SELECT x as time , '' '' as Meeting FROM hour;';
Form1.TableGrid1.dbSQLExecute;

Great smile

Re: Time in Agenda

Next, you can do this:

 Form1.TableGrid1.dbSQL := 'WITH RECURSIVE  hour(x,y) AS ( '+
     'SELECT STRFTIME(''%H:%M'', ''2000-01-01 07:00:00''),1 '+
     'UNION ALL SELECT STRFTIME(''%H:%M'', x, ''+30 minutes''), y + 1 FROM hour '+
     'LIMIT 48 ) SELECT x as time, '' '' as Meeting, y AS id FROM hour '+
     'WHERE CASE WHEN 1=1 THEN id%2 <> 0 else 1 end;';
Form1.TableGrid1.dbSQLExecute;

1. Step 30 minutes
2. Each entry has its own unique virtual ID, which can be used instead of the line number.
3. You can use the checkbox on the form to switch 1 hour - 30 minutes. In CASE processing what records to display (odd - all). IDs are kept UNIQUE.

Re: Time in Agenda

Thank's exact what I wanted