Hello,

For a long time, I struggled with position calculation in lists. The xpaths we used never worked nice. The issue was that the position was caluclated on all lists with the same role and not the one where the item was added to. Finaally, I found one which works so I thought I share this with everyone.

<?xml version="1.0"?>
<!DOCTYPE list PUBLIC "-//MMBase/DTD editwizard 1.0//EN" "http://www.mmbase.org/dtd/wizard-schema_1_0.dtd";> <list role="posrel" destination="urls" minoccurs="0" maxoccurs="*" orderby="[EMAIL PROTECTED]'pos']" ordertype="number">

   <action type="create">
       <relation destinationtype="urls" role="posrel">
<field name="pos">{sum(//[EMAIL PROTECTED]'posrel' and @lastitem='true']/[EMAIL PROTECTED]'urls']/../[EMAIL PROTECTED]'pos'])+{$pos}}</field>
           <object type="urls" />
       </relation>
   </action>
</list>

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

Reply via email to