This topic is 6612 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

• Newbies

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

Thanks

Jacques

##### Share on other sites

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.

##### Share on other sites

• Newbies

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

##### Share on other sites

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?

##### Share on other sites

Here is a thread that may be of interest:

Good Luck.

Garry

##### Share on other sites

• Newbies

Thank you all for your replies. It will help me.

Jacques

##### Share on other sites

This topic is 6612 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account