- From: Erik Bruchez <ebruchez@orbeon.com>
- Date: Wed, 12 Dec 2007 13:33:43 -0800
- To: "Forms WG (new)" <public-forms@w3.org>
All, As you know I am no fan of adding new functions, as everybody could come up with a function that suits his own needs. Also, this function is trivially (and arguably even more clearly) expressed in XPath 2.0 without the need for supplementary functions: <output value="sum(for $item in item return $item/quantity * $item/ price)"> My opinion is that we should rather concentrate on accelerating XPath 2.0 adoption in XForms. -Erik On Dec 12, 2007, at 12:22 PM, John Boyer wrote: > > Hello all, > > One of the small features I proposed for XForms 1.2 is a function > called sumproduct() which takes the sum of the pairwise products of > two nodesets. > > Nick responded that this function seemed a little odd because it was > essentially calculating two results. However, it is really only > calculating and returning one result. Moreover, that result can be > determined using a single pass through the two nodesets provided. > > A quick web search for "sumproduct" will indeed show that this is a > *standard* spreadsheet function. The main point is that on > spreadsheets, they actually allow more than two arrays. The > function accumulates the sum of the products of the corresponding > elements in each of the arrays provided. > > I believe it is likely that this function will be needed for our no- > model XForms development, and I am certain it is useful in forms > today. Here is an example: > > <group ref="/purchaseOrder/items"> > <repeat nodeset="item"> > <input ref="productName"> ... > <input ref="quantity">... > <input ref="price">... > <output value="price * quantity"> > <label>Product Value</label> > </output> > </repeat> > > <output value="sumproduct(item/quantity, item/price)"> > <label>Subtotal</label> > </output> > </group> > > You can see here that instance data was not needed for the row > products in order to calculate the subtotal over the whole table. > > This is good because we don't want limitations of XForms to force > people to write their data schemas differently. A key message we > have for XForms is that we provide interactivity and fill > experiences for instances of schema defined by the data architect. > > For no-model XForms development, I think that the output control may > not result necessarily in a data node in the implicit instance. In > this case, there would not be a row product value to refer to, which > is analogous to the situation I created above by using a value > attribute on the output in the repeat. > > Now that there has been some discussion on this, it makes sense to > make a thread for it to > A) find out if there are any other objections to adding this function > B) to see if I've managed to convince Nick yet :-) > > Cheers, > John M. Boyer, Ph.D. > Senior Technical Staff Member > Lotus Forms Architect and Researcher > Chair, W3C Forms Working Group > Workplace, Portal and Collaboration Software > IBM Victoria Software Lab > E-Mail: boyerj@ca.ibm.com > > Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer > Blog RSS feed: http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw > -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/
Received on Wednesday, 12 December 2007 21:34:05 UTC