1

I have two tables. One table has a column ($2) of unsigned integers (#+NAME: ATTRIBUTES). One table is a lookup table (#+NAME: ATTR-LOOKUP) which takes each value from Column $2 in ATTRIBUTES, and looks it up in Column $1 in ATTR-LOOKUP, and places the corresponding value (a signed integer) back into the original table in column $3.

Sample table and formula I'm using:

#+NAME: ATTR-LOOKUP
|  1 | -5 |
|  3 | -4 |
|  5 | -3 |
...

Here is the main table:

#+NAME: ATTRIBUTES
| Attribute | Value | Mod    | Save | Skills          |    |
|-----------+-------+--------+------+-----------------+----|
| STR       |    13 | #ERROR |      | Athletics       | *  |
|-----------+-------+--------+------+-----------------+----|
| DEX       |    15 | #ERROR | *    | Acrobatics      | *  |
...
#+TBLFM: $3=(org-lookup-last $2 (remote(ATTR-LOOKUP, @1$1..@>$1)) (remote(ATTR-LOOKUP, @1$2..@>$2)) '>=)

Any ideas? I spent four hours last night googling and researching (not very well, clearly.)

So, to the question. With debugging enabled, it looks like the formula fails on the predicate. Can anyone see why it might fail, and what I'm doing wrong?

1

Changed the formula:

#+NAME: ATTR-LOOKUP
|  1 | -5 |
|  3 | -4 |
|  5 | -3 |

#+NAME: ATTRIBUTES
| Attribute | Value | Mod | Save | Skills     |   |
|-----------+-------+-----+------+------------+---|
| STR       |    13 |   5 |      | Athletics  | * |
|-----------+-------+-----+------+------------+---|
| DEX       |    15 |   5 | *    | Acrobatics | * |
| FEX       |    -4 |   3 | *    | Acrobatics | * |
#+TBLFM: $3='(org-lookup-last $2 '(remote(ATTR-LOOKUP, @1$2..@>$2)) '(remote(ATTR-LOOKUP, @1$1..@>$1)) '>=);L

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.