Kees Jongenburger wrote:
> 2005/12/6, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > Hi,
> >
> > I am relativle new in mmbase (two weeks), so a question is very simple.
> > I have two tables  (project, people) and relation (rolerel). I simple
> > want to list something like next:
> >
> > Project                  People               Role
> > ---------------------------------------------------------------------
> > NewProject            Jason                Admin
> > NewProject1          Kelvin                Developer ......
> Hi
> one way should be something like this
>   <mm:listnodes path="news,posrel,images">
>    <mm:node element="posrel">
>      <mm:field name="pos"/>
>    </mm:node>
>    <mm:node element="images">
>    <img src="<mm:image template="s(200)" />" alt="<mm:field name="title" />" 
> />
>    </mm:node>
>   </mm:listnodes>
> but that doesn't work for me j
> 
> ava.lang.IllegalArgumentException: You cannot use non-existing field
> of 'posrel' of node '65' existing fields of 'news are [_exists, title,
> owner, _number, intro, body, subtitle, otype, number]

Yes, posrel is not field of news, that is correct. Perhaps it should
have thrown an exception mentioning the 'element' attribute (Like
''posrel' is not an element of this node'), but that's only a detail.

I would do something like this:

<mm:listnodes type="projects">                  
  <mm:field name="title" />
  <mm:listrelations type="people" role="rolerel">
     <mm:field name="role" />
     <mm:relatednode>
         <mm:field name="firstname" />
     </mm:relatednode>
  </mm:listrelations>
</mm:listnodes>

or, more classicly, with a 'multilevel':

<mm:list path="project,role,people"
  fields="project.title,role.role,people.firstname">
  <mm:field name="project.title" />
  <mm:field name="role.role" />
  <mm:field name="people.firstname" />
</mm:list>

There are some differnce bwteen the aproaches. In the first one only
'real' nodes are involved so there is no need to specify the fields
twice. If you forget to specifiy a field on an mm:list, it will work,
but on a performance penalty. In the first approach, you show the
project, also if there are no people related, which might be what you
want, or might not be want you want...

Michiel



-- 
Michiel Meeuwissen                  mihxil'
Peperbus 111 MediaPark H'sum          [] ()
+31 (0)35 6772979         nl_NL eo_XX en_US



_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers

Reply via email to