Newbies kenogami Posted February 16, 2005 Newbies Posted February 16, 2005 I look in all the posts and find nothing. So if somebody can help me. Say I have two fields. One is a name of a project and the other is a total for the project. I can have many records for a project. Something like Field 1 field 2 project1 120,50 project1 50,25 project1 30,25 project2 323,67 project2 63,63 project2 23,67 In a javascript, I want to add the numbers so i can have sub-summary for each project. In my script in Javascript I have a line like this within a [fmp-record] TotalProject += "[FMP-Field:TotalBCNet]"; My problem is that it does not add the numbers so the result would be 200,00 for project1 but write Project1 120,5050,2530,25 Does somebody have an answer? Thanks Jacques
Zero Tolerence Posted February 17, 2005 Posted February 17, 2005 It looks as if it is reading your numbers as text, Perhaps if you took the Double quotes off around your [FPM-Field:TotalBCNEt] If I'm not mistaken, in Javascript, you only use double quotes in a calculation if your doing text. That would be my first guess.
Newbies kenogami Posted February 17, 2005 Author Newbies Posted February 17, 2005 I try that too. But then nothing show up in the page. I am french speaking (I hope I don't do much mistakes in writing). In french the way to write the numbers are different. We use the coma to divide the dollars with the cents (1,00 instead of 1.00). In the database, I have a calculation field that change the coma for a point. When I look at the code of the page the numbers are there but nothing appears in the page. Here is the whole script. <script LANGUAGE="JavaScript"> var TotalProjet = 0; var TotalParProjet = 0; var Projet = ""; [FMP-Record] if (Projet == "[FMP-Field:BCProjet]") { TotalParProjet +=[FMP-Field:TotalBCNetAff]; TotalProjet +=[FMP-Field:TotalBCNetAff]; } else { document.write(TotalProjet + " " + TotalParProjet + "<br>"); Projet = "[FMP-Field:BCProjet]"; TotalParProjet += [FMP-Field:TotalBCNetAff]; TotalProjet += [FMP-Field:TotalBCNetAff]; } ; [/FMP-Record] document.write(Projet + " " + TotalParProjet + "<br>"); document.write("Total : " + TotalProjet); </script> It's a script that I copy fron that forum which I appreciate a lot. Thank you for the help. Jacques
Zero Tolerence Posted February 17, 2005 Posted February 17, 2005 Since i'm not to proficent with Javascript anymore, I would suggest doing it in Filemaker then. Its easy to set up a calculation field the way you want, why not just do that?
Garry Claridge Posted February 19, 2005 Posted February 19, 2005 Here is a thread that may be of interest: Summaries Good Luck. Garry
Newbies kenogami Posted February 22, 2005 Author Newbies Posted February 22, 2005 Thank you all for your replies. It will help me. Jacques
Recommended Posts
This topic is 7284 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now