[pmwiki-users] Creating an expense report with Fox and calc

Hans design5 at softflow.co.uk
Mon May 26 03:32:02 CDT 2008

Friday, May 23, 2008, 5:58:39 PM, Scott Smith wrote:

> I'm trying to create an expense report. I have Fox working; I have calc
> working. I can't seem to combine the two on the form.

{(calc ...)} is a markup expression. You can us eit in a fox template
in this syntax: {$$(calc ...)} and then it will get evaluated when
the fox form is submitted. You can use other input from fields as
{$$fieldname} replacement variables inside the calc expression.

> I guess I'm looking for an approach to the problem - the right mixture of
> recipes. Or, even something as slick as sortable tables (where you click a
> button and JavaScript magic happens).

http://www.pmwiki.org/wiki/Cookbook/SortableTables has got a SUM
feature: by having the string 'SUM' in a bottom row cell (bottom row
with %rownosort%) the sum of the numeric values of cells in the
column will be shown.

> The real sticky part is getting totals. Perhaps I have to process the form
> twice: Once to get the values, and then a second time to get the totals?

If you use SortableTables it would be enough to use  a Fox form to add
a row to a table.

If you use calc you may need two forms: one for adding  a new row,
and one for replacing or displaying calculated totals of the existing
table. But this may possibly be combined as two steps in one form

But I am not sure how you can feed the calc expression the numbers
from a dynamic range of cells (to allow adding more rows).


More information about the pmwiki-users mailing list