Groups | Search | Server Info | Login | Register
Groups > comp.sys.acorn.apps > #19416
| From | "Richard Torrens (News) <News@Torrens.org> |
|---|---|
| Newsgroups | comp.sys.acorn.apps |
| Subject | Re: Pipedream lookup error in custom function |
| Date | 2025-04-13 11:42 +0100 |
| Organization | Torrens |
| Message-ID | <5c0cdfa5f8news*@Torrens.org> (permalink) |
| References | <50d0090c5c.harriet@bazleyfamily.co.uk> |
In article <50d0090c5c.harriet@bazleyfamily.co.uk>,
Harriet Bazley <harriet@bazleyfamily.co.uk> wrote:
> I have a fairly basic Pipedream custom function that adds up the total
> of all the items that match an arbitrary list of categories (items of
> expenditure that come under the heading of 'food'). But it gives an
> error if any of the categories in the list are not found in the input,
> because the lookup function fails.
> Typical usage:
> edibles(array1,array2), where array 1 and array2 are non-consecutive
> database columns containing categories of expenditure (e.g. Transport,
> Grocery, Clothes) and totals spent under those categories. I just want
> to be able to add up the subtotal of the amount spent on edible items
> specifically.
> But how do I 'blank' the input so that a non-existent category is
> counted as having a value of zero, rather than throwing an error?
> Currently I have to manually add an extra row to the input arrays, e.g.
> "Dairy", 0, in order to suppress the error when in occurs.
> I feel that it ought to be possible to have some kind of 'if' option
> that would return zero if the lookup fails, but I can't work out a way
> of doing it.)
> =================================
> Add up the total value of all the entries in array 2 which correspond to
> entries in array 1 that match one of the text values specified in this
> function.
> ------------------------------------------------------------------------
> ...function("edibles","categories:array","prices:array")
> ...lookup(C7,@categories,@prices) Dairy
> ...lookup(C8,@categories,@prices) Greengrocery
> ...lookup(C9,@categories,@prices) Grocery
> ...lookup(C10,@categories,@prices) Meat
> ...result(sum(A7A10))
I think you need to use dsum()
--
------------------------------------------------------------------
Richard Torrens.
Back to comp.sys.acorn.apps | Previous | Next — Previous in thread | Next in thread | Find similar
Pipedream lookup error in custom function Harriet Bazley <harriet@bazleyfamily.co.uk> - 2025-04-11 20:46 +0100
Re: Pipedream lookup error in custom function "Richard Torrens (News) <News@Torrens.org> - 2025-04-13 11:42 +0100
Re: Pipedream lookup error in custom function Harriet Bazley <harriet@bazleyfamily.co.uk> - 2025-04-13 18:14 +0100
csiph-web