- From: John Boyer <boyerj@ca.ibm.com>
- Date: Wed, 12 Dec 2007 12:22:00 -0800
- To: Forms WG (new) <public-forms@w3.org>
- Message-ID: <OF4553DCA6.2741FAB2-ON882573AF.006BB1CC-882573AF.006FE086@ca.ibm.com>
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
Received on Wednesday, 12 December 2007 20:22:18 UTC