ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* spreadsheet product of two cells in current row
@ 2021-11-12 11:20 juh via ntg-context
  2021-11-12 11:55 ` Wolfgang Schuster via ntg-context
  0 siblings, 1 reply; 11+ messages in thread
From: juh via ntg-context @ 2021-11-12 11:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: juh


[-- Attachment #1.1: Type: text/plain, Size: 770 bytes --]

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



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 11:20 spreadsheet product of two cells in current row juh via ntg-context
@ 2021-11-12 11:55 ` Wolfgang Schuster via ntg-context
  2021-11-12 12:47   ` juh via ntg-context
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2021-11-12 11:55 UTC (permalink / raw)
  To: juh, mailing list for ConTeXt users; +Cc: 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?

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 11:55 ` Wolfgang Schuster via ntg-context
@ 2021-11-12 12:47   ` juh via ntg-context
  2021-11-12 13:27     ` juh via ntg-context
  0 siblings, 1 reply; 11+ messages in thread
From: juh via ntg-context @ 2021-11-12 12:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: juh


[-- Attachment #1.1: Type: text/plain, Size: 1480 bytes --]

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



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 12:47   ` juh via ntg-context
@ 2021-11-12 13:27     ` juh via ntg-context
  2021-11-12 13:33       ` Wolfgang Schuster via ntg-context
  2021-11-12 13:42       ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 11+ messages in thread
From: juh via ntg-context @ 2021-11-12 13:27 UTC (permalink / raw)
  To: ntg-context; +Cc: juh


[-- Attachment #1.1: Type: text/plain, Size: 275 bytes --]

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 13:27     ` juh via ntg-context
@ 2021-11-12 13:33       ` Wolfgang Schuster via ntg-context
  2021-11-12 15:51         ` juh via ntg-context
  2021-11-12 13:42       ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 11+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2021-11-12 13:33 UTC (permalink / raw)
  To: juh, ntg-context; +Cc: Wolfgang Schuster

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 13:27     ` juh via ntg-context
  2021-11-12 13:33       ` Wolfgang Schuster via ntg-context
@ 2021-11-12 13:42       ` Hans Hagen via ntg-context
  2021-11-12 15:56         ` juh via ntg-context
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-12 13:42 UTC (permalink / raw)
  To: juh, ntg-context; +Cc: Hans Hagen

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 13:33       ` Wolfgang Schuster via ntg-context
@ 2021-11-12 15:51         ` juh via ntg-context
  0 siblings, 0 replies; 11+ messages in thread
From: juh via ntg-context @ 2021-11-12 15:51 UTC (permalink / raw)
  To: ntg-context; +Cc: juh


[-- Attachment #1.1: Type: text/plain, Size: 1272 bytes --]

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



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 13:42       ` Hans Hagen via ntg-context
@ 2021-11-12 15:56         ` juh via ntg-context
  2021-11-12 16:15           ` juh via ntg-context
  2021-11-12 17:06           ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 11+ messages in thread
From: juh via ntg-context @ 2021-11-12 15:56 UTC (permalink / raw)
  To: ntg-context; +Cc: juh


[-- Attachment #1.1: Type: text/plain, Size: 702 bytes --]

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



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 15:56         ` juh via ntg-context
@ 2021-11-12 16:15           ` juh via ntg-context
  2021-11-12 17:06             ` Hans Hagen via ntg-context
  2021-11-12 17:06           ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 11+ messages in thread
From: juh via ntg-context @ 2021-11-12 16:15 UTC (permalink / raw)
  To: ntg-context; +Cc: juh


[-- Attachment #1.1: Type: text/plain, Size: 729 bytes --]

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



[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 16:15           ` juh via ntg-context
@ 2021-11-12 17:06             ` Hans Hagen via ntg-context
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-12 17:06 UTC (permalink / raw)
  To: juh, ntg-context; +Cc: Hans Hagen

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: spreadsheet product of two cells in current row
  2021-11-12 15:56         ` juh via ntg-context
  2021-11-12 16:15           ` juh via ntg-context
@ 2021-11-12 17:06           ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-12 17:06 UTC (permalink / raw)
  To: juh, ntg-context; +Cc: Hans Hagen

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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-11-12 17:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 11:20 spreadsheet product of two cells in current row juh via ntg-context
2021-11-12 11:55 ` Wolfgang Schuster via ntg-context
2021-11-12 12:47   ` juh via ntg-context
2021-11-12 13:27     ` juh via ntg-context
2021-11-12 13:33       ` Wolfgang Schuster via ntg-context
2021-11-12 15:51         ` juh via ntg-context
2021-11-12 13:42       ` Hans Hagen via ntg-context
2021-11-12 15:56         ` juh via ntg-context
2021-11-12 16:15           ` juh via ntg-context
2021-11-12 17:06             ` Hans Hagen via ntg-context
2021-11-12 17:06           ` Hans Hagen via ntg-context

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).