Hello,

I reply myself.
- in Live Table, we get object with $row (I don't try it but suppose that
[3] is true)
- other else we get object with $doc

Regards,

Arnaud.



2014-08-06 15:26 GMT+02:00 Arnaud bourree <[email protected]>:

> Hello
>
> *How can we used Computed Field?*
> In XWiki Data Model page [1] I found:
> *Computed pseudofield*  new in 4.2M3  Allows to create a pseudo field for
> which the display can be configured using a script. It allows to combine
> other fields together.And in 4.2 release note [2]:
> Another new type of class fields adds support for *virtual values*
> computed live from other class values, data from the database, data
> obtained from an external service, or practically any other source of data.
> These fields are non-editable and aren't stored in the database, since they
> only provide some wiki content that will be rendered each time such a
> property is displayed.
> Traditionally, this kind of computation would have been written directly
> in the sheet used to display instances of that class, but putting it in a
> class field allows easier reuse of the code, since the property will be
> *displayed* in livetables, when indexing the document in Lucene, when
> displaying documents in an index page, and so on.
>
> I try to used it with a Contact class I defined as following
> <<Contact>>
> String firstName
> String lastName
> ComputedField fullName
>
> I found in mail history only one explanation about this field [3]
> So, for fullName field, I set script with
> {{velocity}}
> $row.firstName $row.lastName
> {{/velocity}}
>
> And that display:
> $row.firstName $row.lastName
>
> OK, [3] speak about Live Table, but what's about displaying this field in
> other place?
>
> Regards,
>
> Arnaud.
>
> [1] http://platform.xwiki.org/xwiki/bin/view/DevGuide/DataModel
> [2]
> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki42#HComputedclassfields
> [3] http://xwiki.475771.n2.nabble.com/Computed-fields-td7586948.html
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to