From: Henning Hraban Ramm <texml@fiee.net>
To: ntg-context@ntg.nl
Subject: [NTG-context] Re: max function in spreadsheettable
Date: Tue, 15 Oct 2024 12:42:00 +0200 [thread overview]
Message-ID: <120fd637-7671-4252-921c-9dc08c328d77@fiee.net> (raw)
In-Reply-To: <8291d068-6311-422d-a6d2-eaadba2a2a9a@mailbox.org>
Am 15.10.24 um 10:59 schrieb juh+ntg-context--- via ntg-context:
> Dear all,
>
> I have a cell that calculates a value that may not be a negative value.
> If it is a negatiive value the cell should show zero.
>
>
> \startcell[style=normal]
> @ "0.2f EUR" $pauschale.eintag$ - ((D[row] * (0.2 *
> $pauschale.vororttag$)) + (E[row] * (0.4 * $pauschale.vororttag$)) +
> (F[row] * (0.4 * $pauschale.vororttag$)))
> \stopcell
>
> The $-variables will get resolved by Pandoc before ConTeXt comes into play.
>
> As far as I understood the handdbook spreadsheets-mkiv.pdf it is
> possible to define lua functions inside a cell.
>
> Who would you implement a max function that sets the value to 0 if it is
> negative?
I’d advise against using the spreadsheet module and for CLD, i.e.
creating the table from the Lua end. How that works from Markdown
metadata (that I know you’re using) I’m not sure. It might make sense to
avoid the Pandoc step and read Markdown or whatever input format with Lua.
WRT German: if you setup a decimal comma with the spreadsheet module,
all dots get replaced by commas, e.g. in abbreviations – one reason to
avoid that module.
Otherwise it should be possible to define that function in Lua and use
it in the table.
I guess you know the cld-mkiv manual?
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2024-10-15 10:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 8:59 [NTG-context] " juh+ntg-context--- via ntg-context
2024-10-15 10:42 ` Henning Hraban Ramm [this message]
2024-10-15 12:33 ` [NTG-context] " juh+ntg-context--- via ntg-context
2024-10-15 15:16 ` Hans Hagen via ntg-context
2024-10-15 19:37 ` juh+ntg-context--- via ntg-context
2024-10-15 19:58 ` Wolfgang Schuster
2024-10-16 5:43 ` juh+ntg-context--- via ntg-context
2024-10-15 20:04 ` Henning Hraban Ramm
2024-11-14 7:59 ` [NTG-context] string.formatters (was: Re: max function in spreadsheettable) juh+ntg-context--- via ntg-context
2024-11-14 8:18 ` [NTG-context] Re: string.formatters juh+ntg-context--- via ntg-context
2024-11-14 18:23 ` Wolfgang Schuster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=120fd637-7671-4252-921c-9dc08c328d77@fiee.net \
--to=texml@fiee.net \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).