Sannyassin

Surely here you could be utilizing  2D arrays? 

e.g
Array (aInvoices)-1D
array (aInvoiceItems)-1D
array (ainvoiceValue)-1D

Array (ainvoiceItemNumbers)-2D)-on row per invoice one column per item
array (ainvoiceitemDescription)-2D Ditto
Array(aInvoiceItemQuantitySold)-2D Ditto
Array(aItemSoldAmount-2D

You don’t say if you are displaying these arrays on screen-obviously the 2D 
arrays can’t be displayed on screen.

With the above representation in a listbox on screen the ‘summarisation’ column 
could be a formula based column
eg. Sum(aItemSoldAmount{rownumber}. You can insert the ‘summary’ column in 
dynamically. 

The following brief(unrelated) example shows how to insert a formula based 
column in a listbox

$Formula:=“LB_SUMMARISE(->”+aItemSoldAmount+”)”)
LISTBOX INSERT COLUMN 
FORMULA($area->;$ColumnNumber;$ColumnName;$Formula;$Type;$HeaderName;$ptr3->)

There are a couple of limitations of formula based listbox columns though-cant 
have a footer and cant sort on them.







> On 20 Jun 2017, at 23:25, Sannyasin Siddhanathaswami via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> Aloha,
> 
> Does anyone have a utility method for summarizing (and summing) a set of 
> arrays?
> 
> For example with Invoice Line Items:
> 
> Arrays:
> aItemNumbers
> aItemDescription
> aQuantitySold
> aExtendedSoldAmount
> 
> Of course, with invoice line items there are multiple records with item 
> numbers. I want a summary array where there is only 1 element with an item 
> number, and the aQuantitySold, and aExtendedSoldAmount gets summed.
> 
> I know there’s lots of ways to do this, but didn’t want to reinvent the wheel 
> if possible.
> 
> Thanks!
> 
> Sannyasin Siddhanathaswami
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to