baseportal
Start

baseportal message board

Welcome to the baseportal message board...

Please read the FAQ.

 
 Selected message: To the list 
    Message from Qasem Alsaleh on 5/21 2003, 21:44 +00:00
    EMail: qalsaleh@hotmail.com

    Re: How to get the Sum of data from a field ?


      Dear Christoph Bergmann
      Thank you for your reply. I tried your suggestion but I am getting error messages. The point is that I dont know the Perl language and thus cannot find out the problem !! I have used one of the available templates to start my work. If you dont mind to go to the page I am using (http://baseportal.com/baseportal/qalsaleh/CME_Search) and view the source code of the page. For a search example you can enter: 10118/M in the CME No search field.
      I would be so grateful if you can help in this issue.
      Thanks so much.

    Your reply:

    Name: EMail: WWW:
    Subject:
    Text:
    Timezone:

    Post a new message


 All messages from this thread: To the list 
    Message from Qasem Alsaleh on 5/18 2003, 21:39 +03:00
    EMail: qalsaleh@hotmail.com

    How to get the Sum of data from a field ?


      I am very new to Perl. My question (which might be a very simple one) is: I want to get the Sum of data from a field named (CME\ Points). The data is the result of a search process in the database. So, how to get the Sum of the data from that particular field (a column in the database)?
      Thanks in advance..
     Post a reply

    Message from Christoph Bergmann on 5/21 2003, 20:18 +01:00
    EMail: info@baseportal.com

    Re: How to get the Sum of data from a field ?


      You are right, it is simple ;-)

      <loop>
      $sum=$sum+$_loop{"CME\Points"};
      </loop>
      The sum is $sum

      I guess you work with <do action=all> ? If so, just put the above code in your template and it should work...

     Post a reply

    Message from Qasem Alsaleh on 5/21 2003, 21:44 +00:00
    EMail: qalsaleh@hotmail.com

    Re: How to get the Sum of data from a field ?


      Dear Christoph Bergmann
      Thank you for your reply. I tried your suggestion but I am getting error messages. The point is that I dont know the Perl language and thus cannot find out the problem !! I have used one of the available templates to start my work. If you dont mind to go to the page I am using (http://baseportal.com/baseportal/qalsaleh/CME_Search) and view the source code of the page. For a search example you can enter: 10118/M in the CME No search field.
      I would be so grateful if you can help in this issue.
      Thanks so much.

     Post a reply


    Message from Christoph Bergmann on 5/22 2003, 04:27 +01:00
    EMail: info@baseportal.com

    Re: How to get the Sum of data from a field ?


      Ok, I forgot sth., it should be

      <loop code=perl>
      ...etc.

      And the field is "CME Points", not "CME\Points".

      I placed the code in your page I hope it was Ok ;-)

      But: Are the numbers you entered correct? I mean "3.000" or "2.000" - do you mean "3000" or "3" in the first case? Do you use the dot for marking thousands? If so the result is not correct - in Perl (and in English) the dot "." is the decimal point...

     Post a reply

    Message from Qasem Alsaleh on 5/22 2003, 21:54 +03:00
    EMail: qalsaleh@hotmail.com

    Re: How to get the Sum of data from a field ?


      Dear Christoph Bergmann

      You have been so helpful indeed..
      Regarding the numbers you mentioned, I meant 2, 3 etc not 2000... and the sum of numbers is correct.
      I am very grateful :)
     Post a reply

    Message from Christoph Bergmann on 5/22 2003, 20:44 +01:00
    EMail: info@baseportal.com

    Re: How to get the Sum of data from a field ?


      You're welcome... ;-)
     Post a reply
     
 Messages from 3150 to 3300: To the input form 
<< Newest messages | < Newer messages | To the input form | Older messages > | Oldest messages >>


Back to the homepage

© baseportal.com. All rights reserved. Terms of use



baseportal.com