Sergiu posted a good explanation of the DatabaseList and DatabaseTree usage,
which I must admit is a bit obscure for XWiki newbies :
First, a bit of introduction on DBList and DBTreeList.
StaticList properties, when edited, allow the user to select one of the
predefined values (or more, if the property has "multiple select" =
true). DBList does something similar, allows the user to select one or
more values from a list of values, but the list is not predefined, it is
populated with values from the database.
DBTreeList does the same as DBList, but also induces a pseudo-hierarchy
in the option list, displaying the options as a tree.
DBList and DBTreeList properties work in two ways.
One is with an hql query, which allows complete flexibility on what you
want to select. For DBList you select one or two columns. The first
column is the list of possible values that get into the option list. The
second (optional) column allows to separate the actual value that gets
stored in the database, and the values that are displayed to the user.
This allows, for example, to store XWiki.JohnDoe in the database, but to
display "Doe, John" in the interface. If only one column is selected,
the value displayed is the same as the value used internally.
DBTreeList queries must select 3 columns. The first two are the same as
for DBList, while the 3rd column defines the child<->parent relations.
Selected rows that have null or an empty string on the third column will
be considered the roots of the tree. Rows that have a value "X" on the
third column will be inserted as child nodes of the node with value "X"
(the first column).
The second way to define the option lists is by using the fields: XWiki
Class Name, Id Field Name, Value Field Name and Parent Field Name. Using
those fields, the XWiki platform constructs the following hql queries:
select idprop.value, valueprop.value, parentprop.value from
XWikiDocument doc, BaseObject obj, StringProperty idprop, StringProperty
valueprop, StringProperty parentprop.value where obj.name = doc.name and
obj.className = "value entered in Class name" and idprop.id.id = obj.id
and idprop.id.name = "value entered in Id Field Name" and
valueprop.id.id = obj.id and valueprop.id.name = "value entered in Value
Field Name" and parentprop.id.id = obj.id and parentprop.id.name =
"value entered in Parent Field Name"
So, it selects from objects of a given type (XWiki Class) 3 properties
(of storage type String, read bellow what this means). As a special
case, you can use "doc.<some doc property>" or "obj.<some object
property>" instead of property names, and the query is adapted
accordingly. In the case of DBList, only 2 columns are selected, as the
Parent property is not used/defined.
String storage type means:
- either a property of type String
- or a property of type StaticList, DBList or DBTreeList with
multipleSelect = false
If you want to use the DBTreeList, you must model your data so that they
will allow these kind of queries.
Hope this will help, cheers
Hoani CROSS
--
Globotraders Tahiti founder [
http://globotraders-tahiti.com]
hel-o wrote:
Hi,
and thanks for your response. I am aware of that documentation but i was
looking for a more detailed desription of the available properties.
Is it possible to make a Data Base Property that shows a Object of another
Class a link to that Object?
Thanks
Helmut
Jean-Vincent Drean-3 wrote:
On Sun, Dec 14, 2008 at 6:28 PM, hel-o <hel(a)hel.at> wrote:
Hi,
is there a documentation for the existing property types of a class
available?
I found the tutorial about creating a class but no discription of the
property types.
See
http://platform.xwiki.org/xwiki/bin/view/DevGuide/DataModel
As i understand it deleting a property of a class
is not possible. Is
this
feature planned?
Yes, it is not possible yet. This problem is known and will be
addressed but it is not trivial and doesn't have a high priority.
The usual workaround is to rename properties (to something like
unused_string_1 for example).
JV.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
-----
Hoani CROSS
http://globotraders-tahiti.com Globotraders Tahiti Founder
--
View this message in context:
http://n2.nabble.com/Documentation-Class-Propertys-tp1655023p1667603.html
Sent from the XWiki- Users mailing list archive at
Nabble.com.