cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: Calculated fields
Date Mon, 10 Apr 2006 09:19:28 GMT


hepabolu wrote:

> First off: great idea!
>
> I agree with Antonio that the syntax should be more flexible than your 
> initial proposal. I actually had a use case that required even more 
> elaborate calculation:
>
> The score is the sum of a number of fields (not part of a repeater) 
> only if all of the fields are set to a value. Example:
>
> Field1, Field2, Field3: each have a range 0..3
>
> TotalScore =
> if (empty(Field1) || empty(Field2) || empty(Field3)) {
>  sum(Field1, Field2, Field3)
> }
> else {
>   "score undefined"
> }
>
> So two additions:
> - use calculated fields for all widgets, rather than just repeaters
> - allow a more flexible way of expressing the calculation, maybe a 
> user-defined class of Expression or Algorithm.

Yes, in my current prototype implementation you are not limited to 
repeaters at all! And Algorithms are java classes, already started 
writing one for javascript snippet.

>
> I don't have the proper syntax available here, but the last two could 
> be done in much the same way as the <fd:value-changed> syntax.

Yeah, exactly, they are configured in xconf, as for every other 
component. The syntax with fd:value for me is absolutely ok, as long as 
you can specify a @type or something to choose between javascript, 
xreporter, premade or custom algorithm implementations.

Simone

-- 
Simone Gianni

Mime
View raw message