cancel
Showing results for 
Search instead for 
Did you mean: 

Sum fields problem

gigiooo
Champ in-the-making
Champ in-the-making
Hello,
I start the alfresco and try to learn sth. and got such problem
I have aspect  and child association to this apsect for example:

<types>
<type name="my:Costs">
          <title>Costs</title>
          <properties>
             <property name="my:sellPrice">
                <type>d:double</type>
             </property>
             <property name="my:sellQuantity">
                <type>d:int</type>
             </property>   
        <property name="my:sellCost">
                <type>d:double</type>
             </property>
          </properties>   
   
</type>
</types>

<aspect name="my:Invoice">
<properties>       
<property name="my:invoiceNumber">
                <type>d:text</type>
             </property>
             <property name="my:invoiceCompany">
                <type>d:text</type>
             </property>
              <property name="my:invoiceDate">
                <type>d:date</type>
             </property>
        <property name="my:invoiceComment">
                <type>d:text</type>
             </property>
</properties>
      <associations>
         <child-association name="my:invoiceElements">
               <target>
                  <class>my:Costs</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </child-association>
         </associations>
</aspect>
and i need to get  sellCost = sellPrice*sellQuantity can someone can write how to do this?
Because i dont have any idea how to do this.
Please help me
2 REPLIES 2

fstnboy
Champ on-the-rise
Champ on-the-rise
Hi,

To start with, have a look at the article Jeff Potts wrote about dealing with content model.

Hope it can help you with it, don't know if you have to do it in Java, Javascript or how you want to do it.

gigiooo
Champ in-the-making
Champ in-the-making
I could do it on Java or JavaScript.
I think better will be JavaScript, because this sum will be make dynamic, on page and then save at properties of document.