emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org table: generate a weekly calendar with column that represents the hours
@ 2022-04-22  6:54 Uwe Brauer
  2022-04-22  9:23 ` Eric S Fraga
  2022-05-04 22:22 ` TRS-80
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Brauer @ 2022-04-22  6:54 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1222 bytes --]


Hi

I am looking for  convenient method to generate a weekly calendar in
table form that looks like
#+begin_src 

|       Hours | Mon | Tue | Wed | Thu | Fri |
|   8:00-9:00 |     |     |     |     |     |
|  9:00-10:00 |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
|             |     |     |     |     |     |
| 19:00-20:00 |     |     |     |     |     |
#+end_src

But, of course the missing hours should be inserted automatically.

A poor man's solution would be to do it manually and to save the table as a template, but is there a way to generate it using org's table functionality?

Thanks and regards

Uwe Brauer 

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org table: generate a weekly calendar with column that represents the hours
  2022-04-22  6:54 org table: generate a weekly calendar with column that represents the hours Uwe Brauer
@ 2022-04-22  9:23 ` Eric S Fraga
  2022-04-22 12:47   ` Uwe Brauer
  2022-05-04 22:22 ` TRS-80
  1 sibling, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2022-04-22  9:23 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: Org Mode List

Something to play with:

| start | duration |   end | notes |
|-------+----------+-------+-------|
| 08:00 |     1:00 | 09:00 |       |
| 09:00 |    01:00 | 10:00 |       |
| 10:00 |    01:00 | 11:00 |       |
| 11:00 |    01:00 | 12:00 |       |
| 12:00 |    01:00 | 13:00 |       |
| 13:00 |    01:00 | 14:00 |       |
| 14:00 |    01:00 | 15:00 |       |
| 15:00 |    01:00 | 16:00 |       |
| 16:00 |    01:00 | 17:00 |       |
| 17:00 |    01:00 | 18:00 |       |
| 18:00 |    01:00 | 19:00 |       |
| 19:00 |    01:00 | 20:00 |       |
| 20:00 |    01:00 | 21:00 |       |
#+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U

-- 
: Eric S Fraga, with org release_9.5.3-397-g81289b in Emacs 29.0.50


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org table: generate a weekly calendar with column that represents the hours
  2022-04-22  9:23 ` Eric S Fraga
@ 2022-04-22 12:47   ` Uwe Brauer
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Brauer @ 2022-04-22 12:47 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1955 bytes --]

>>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Something to play with:
> | start | duration |   end | notes |
> |-------+----------+-------+-------|
> | 08:00 |     1:00 | 09:00 |       |
> | 09:00 |    01:00 | 10:00 |       |
> | 10:00 |    01:00 | 11:00 |       |
> | 11:00 |    01:00 | 12:00 |       |
> | 12:00 |    01:00 | 13:00 |       |
> | 13:00 |    01:00 | 14:00 |       |
> | 14:00 |    01:00 | 15:00 |       |
> | 15:00 |    01:00 | 16:00 |       |
> | 16:00 |    01:00 | 17:00 |       |
> | 17:00 |    01:00 | 18:00 |       |
> | 18:00 |    01:00 | 19:00 |       |
> | 19:00 |    01:00 | 20:00 |       |
> | 20:00 |    01:00 | 21:00 |       |

> #+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U
Thanks very much let me see whether I understand its logic

I tried

| start | duration |   end | notes |
|-------+----------+-------+-------|
| 08:00 |     1:00 | 09:00 |       |
#+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U

I put the cursor say on the word «start»
And then fire up  C-c C-c, nothing happens. I fire up C-u C-u C-c C-c and it complains because the expression 
points outside the table

| start | duration |   end | notes |
|-------+----------+-------+-------|
| 08:00 |     1:00 | 09:00 |       |
|       |          |       |       |
#+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U

Now C-u C-u C-c C-c gives

| start | duration |   end | notes |
|-------+----------+-------+-------|
| 08:00 |     1:00 | 09:00 |       |
| 09:00 |    01:00 | 10:00 |       |
#+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U

Very very nice, so I can proceed like this.


Thanks a lot!

Uwe 
-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org table: generate a weekly calendar with column that represents the hours
  2022-04-22  6:54 org table: generate a weekly calendar with column that represents the hours Uwe Brauer
  2022-04-22  9:23 ` Eric S Fraga
@ 2022-05-04 22:22 ` TRS-80
  1 sibling, 0 replies; 4+ messages in thread
From: TRS-80 @ 2022-05-04 22:22 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> I am looking for  convenient method to generate a weekly calendar in
> table form that looks like
>
> #+begin_src 
>
> |       Hours | Mon | Tue | Wed | Thu | Fri |
> |   8:00-9:00 |     |     |     |     |     |
> |  9:00-10:00 |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> |             |     |     |     |     |     |
> | 19:00-20:00 |     |     |     |     |     |
> #+end_src
>
> But, of course the missing hours should be inserted automatically.
>
> A poor man's solution would be to do it manually and to save the table
> as a template, but is there a way to generate it using org's table
> functionality?

Eric gave you a way that you asked (using Org table functionality), but
another way could be to simply use a bunch of insert statements.  Or
rather, 1-2 to insert the header, followed by a loop with a starting
time, interval, etc.

Two advantages to that approach:

1. You could specify start, end time and resolution (spacing) as
arguments (might not be needed).

2. You would not need a 'duration' column.

3. No need for formula (which leaves more room for your own, should you
need it).

Just another way to do the same thing.

Cheers,
TRS-80





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-04 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22  6:54 org table: generate a weekly calendar with column that represents the hours Uwe Brauer
2022-04-22  9:23 ` Eric S Fraga
2022-04-22 12:47   ` Uwe Brauer
2022-05-04 22:22 ` TRS-80

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).