spreadsheet product of two cells in current row
Dear all, I thought I could find my way through the spreadsheet documentation to make my invoices. While it is simple to calculate the sum or the product of two cells if you know that they are A[2] and B[2] I can't find the solution to access cell A and B *on the same row*. Amount | Single | Sum 2 | 5 | 10 <-- A[currentrow] * B[currentrow] does not work 3 | 4 | 12 ==================== Sum 22 The rows come from a script and there might be several items. Any hints? juh -- Autoren-Homepage: ......... http://literatur.hasecke.com Satiren & Essays: ......... http://www.sudelbuch.de Privater Blog: ............ http://www.hasecke.eu Netzliteratur-Projekt: .... http://www.generationenprojekt.de
juh via ntg-context schrieb am 12.11.2021 um 12:20:
Dear all,
I thought I could find my way through the spreadsheet documentation to make my invoices.
While it is simple to calculate the sum or the product of two cells if you know that they are A[2] and B[2] I can't find the solution to access cell A and B *on the same row*.
Amount | Single | Sum 2 | 5 | 10 <-- A[currentrow] * B[currentrow] does not work 3 | 4 | 12 ==================== Sum 22
The rows come from a script and there might be several items.
Any hints?
Do you have a example because I have no problem to access values in the current row. \usemodule[spreadsheet] \starttext \bTABLE \bTR \bTD Amount \eTD \bTD Single \eTD \bTD Sum \eTD \eTR \bTR \bTD \getspr{2} \eTD \bTD \getspr{5} \eTD \bTD \getspr{A[2] * B[2]} \eTD \eTR \bTR \bTD \getspr{3} \eTD \bTD \getspr{4} \eTD \bTD \getspr{A[3] * B[3]} \eTD \eTR \eTABLE \startspreadsheettable \startrow \startcell "Amount" \stopcell \startcell "Single" \stopcell \startcell "Sum" \stopcell \stoprow \startrow \startcell 2 \stopcell \startcell 5 \stopcell \startcell A[2] * B[2] \stopcell \stoprow \startrow \startcell 3 \stopcell \startcell 4 \stopcell \startcell A[3] * B[3] \stopcell \stoprow \stopspreadsheettable \stoptext Wolfgang
Thank you Wolfgang for your reply. I was lucky in the meantime. Am Fri, Nov 12, 2021 at 12:55:59PM +0100 schrieb Wolfgang Schuster:
juh via ntg-context schrieb am 12.11.2021 um 12:20:
Dear all,
I thought I could find my way through the spreadsheet documentation to make my invoices.
While it is simple to calculate the sum or the product of two cells if you know that they are A[2] and B[2] I can't find the solution to access cell A and B *on the same row*.
Amount | Single | Sum 2 | 5 | 10 <-- A[currentrow] * B[currentrow] does not work 3 | 4 | 12 ==================== Sum 22
The rows come from a script and there might be several items.
Any hints?
I found "row" so: \startcell @ "0.2f EUR" (A[row] * D[row]) \stopcell gives the product of cell A and D in the current row. And I even found row-n \startcell @ "0.2f EUR" 0.19 * E[row-1] \stopcell gives the VAT of cell E in the row before. and: \startcell[align=flushright] @ "0.2f EUR" E[row-1]+E[row-2] \stopcell add the numbers of cell E in the two rows before. It works, but is there a better approach? juh -- Autoren-Homepage: ......... http://literatur.hasecke.com Satiren & Essays: ......... http://www.sudelbuch.de Privater Blog: ............ http://www.hasecke.eu Netzliteratur-Projekt: .... http://www.generationenprojekt.de
Once again me, I set this \setupspreadsheet [ period={,}, comma={.}, split=yes, ] to get german numbers in my invoice like: 10.000,00 EUR. The drawback is that I can't use a normal period and comma in the normal text. Any hints? juh
juh via ntg-context schrieb am 12.11.2021 um 14:27:
Once again me,
I set this
\setupspreadsheet [ period={,}, comma={.}, split=yes, ]
to get german numbers in my invoice like: 10.000,00 EUR.
The drawback is that I can't use a normal period and comma in the normal text.
Any hints?
Not without a complete minimal example. Wolfgang
Am Fri, Nov 12, 2021 at 02:33:45PM +0100 schrieb Wolfgang Schuster:
Not without a complete minimal example.
Sorry, of course. \usemodule[spreadsheet] \setupspreadsheet [ period={,}, comma={.}, split=yes, ] \startspreadsheettable[test][frame=off] \startrow[topframe=on,bottomframe=on] \startcell[align=flushleft] "Anz." \stopcell \startcell[align=flushleft, width=9cm] "Beschreibung" \stopcell \startcell[align=flushleft] "MwSt." \stopcell \startcell[align=flushright] "Einzeln" \stopcell \startcell[align=flushright] "Gesamt" \stopcell \stoprow \startrow \startcell[align=center] 3 \stopcell \startcell[align=flushleft] "Job 1, Job 2 und Job 3." \stopcell \startcell[align=flushright] @ "0.2f \percent" 19 \stopcell \startcell[align=flushright] @ "0.2f €" 70 \stopcell \startcell[align=flushright] @ "0.2f €" (A[row] * D[row]) \stopcell \stoprow \stopspreadsheettable \stoptext Anz. MwSt. And the comma separated enumeration under "Beschreibung". TIA juh -- Autoren-Homepage: ......... http://literatur.hasecke.com Satiren & Essays: ......... http://www.sudelbuch.de Privater Blog: ............ http://www.hasecke.eu Netzliteratur-Projekt: .... http://www.generationenprojekt.de
On 11/12/2021 2:27 PM, juh via ntg-context wrote:
Once again me,
I set this
\setupspreadsheet [ period={,}, comma={.}, split=yes, ]
to get german numbers in my invoice like: 10.000,00 EUR. educational tip:
\starttext \startluacode context("%M",1234567.89) context.par() context("%m",1234567.89) \stopluacode \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am Fri, Nov 12, 2021 at 02:42:13PM +0100 schrieb Hans Hagen:
educational tip:
\starttext
\startluacode context("%M",1234567.89) context.par() context("%m",1234567.89) \stopluacode
\stoptext
Nice, so I can use that instead: \startcell[align=flushright] @ "0.2M €" 70 \stopcell I was looking for the formatting strings, but could not find them. I guess this is a lua thing? String formatting in lua? juh -- Autoren-Homepage: ......... http://literatur.hasecke.com Satiren & Essays: ......... http://www.sudelbuch.de Privater Blog: ............ http://www.hasecke.eu Netzliteratur-Projekt: .... http://www.generationenprojekt.de
Am Fri, Nov 12, 2021 at 04:56:51PM +0100 schrieb juh via ntg-context:
Am Fri, Nov 12, 2021 at 02:42:13PM +0100 schrieb Hans Hagen:
educational tip:
\starttext
\startluacode context("%M",1234567.89) context.par() context("%m",1234567.89) \stopluacode
\stoptext
Nice, so I can use that instead:
\startcell[align=flushright] @ "0.2M €" 70 \stopcell
Ok. This shot was too fast. I give up. ;-) juh -- Autoren-Homepage: ......... http://literatur.hasecke.com Satiren & Essays: ......... http://www.sudelbuch.de Privater Blog: ............ http://www.hasecke.eu Netzliteratur-Projekt: .... http://www.generationenprojekt.de
On 11/12/2021 5:15 PM, juh via ntg-context wrote:
Am Fri, Nov 12, 2021 at 04:56:51PM +0100 schrieb juh via ntg-context:
Am Fri, Nov 12, 2021 at 02:42:13PM +0100 schrieb Hans Hagen:
educational tip:
\starttext
\startluacode context("%M",1234567.89) context.par() context("%m",1234567.89) \stopluacode
\stoptext
Nice, so I can use that instead:
\startcell[align=flushright] @ "0.2M €" 70 \stopcell
Ok. This shot was too fast. I give up. ;-) M or m depending on what you want to achieve
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 11/12/2021 4:56 PM, juh via ntg-context wrote:
Am Fri, Nov 12, 2021 at 02:42:13PM +0100 schrieb Hans Hagen:
educational tip:
\starttext
\startluacode context("%M",1234567.89) context.par() context("%m",1234567.89) \stopluacode
\stoptext
Nice, so I can use that instead:
\startcell[align=flushright] @ "0.2M €" 70 \stopcell
I was looking for the formatting strings, but could not find them. I guess this is a lua thing? String formatting in lua?
a context thing (in cld manual) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
juh
-
Wolfgang Schuster