如何为组织模式表表达以下条件?
for every cell between the 2nd and 3rd hline:
if the cell is empty,
set the contents of the cell to todays date.
else
leave the cells contents as they are.
所以,鉴于下表,我想在空单元格中插入今天的日期。
|------------------|
| date |
|------------------|
| [2014-05-23 Fri] |
| [2014-05-24 Sat] |
| |
|------------------|
答案 0 :(得分:3)
自定义计算功能appendToday将执行您想要的操作。它处理hlines之间的所有字段都为空的情况。
(defmath appendToday (idx v)
(let ((d (date (month (now)) (day (now))))
(len (vlen v)))
(if (<= idx len)
(if (equal (cadr v) 0)
d
(nth idx v)
)
d
)
)
)
评估前的表格如下:
|------------------|
| <2014-05-26 Mon> |
| |
| |
| |
| |
| |
|------------------|
#+TBLFM: @I..@II$1=appendToday(@#,@I..@II$1)
评估后的表格如下:
|------------------|
| <2014-05-26 Mon> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
|------------------|
#+TBLFM: @I..@II$1=appendToday(@#,@I..@II$1)