---
title: "Powermail: Help with Calculated fields - Newbie question"
url: "https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question"
source: "typo3.net"
tags: ["Extensions","English","Frage","Powermail"]
created: "2008-12-02"
last_reply: "2008-12-03"
replies: 4
solved: false
page: 1
pages: 1
lang: "en"
---

# Powermail: Help with Calculated fields - Newbie question

Extensions · 4 Antworten · gestartet 2008-12-02

## Eröffnungsbeitrag

**tanelkoth** · 2008-12-02 · [Beitrag #1](https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question/1)

I use the powermail extension in my websites. Now I would like to have a calculated field in the form. Someone enters a number (say x ordered items) and the calculated field shows the total amount.
My idea is to use a Typoscript object field for this and make the calculation in TS. It is a simple calculation and in TSRef I saw something about a +calc datatype. Can someone explain to me how to code this in TScript? There is very little information on this topic, so I hope someone can shed some light on this.

Thanks for any help,
Erwin

## Antworten

### [#2](https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question/2) · einpraegsam.​net · 2008-12-02

Hello Erwin,

I would integrate this in a similar way. Adding a dynamic typoscript marker and fill it with (e.g.) a userFunc output.

Example for using a dynamic typoscript marker in powermail:
[/d/77031-vorgangsnummer-mit-powermail](https://www.typo3.net/d/77031-vorgangsnummer-mit-powermail)

Alex

### [#3](https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question/3) · tanelkoth · 2008-12-02

Hi Alex,
thanks for the info. I had a look at the examples you refered to and I understand the meaning (I think). If I am correct the actual 'calculation' is done by a PHP-script, right? However, from the TSRef I get (section 1.3):

***Calculating values (+calc):**

Sometimes a datatype is set to "something +calc". "+calc" indicates that the value is calculated with "+-/*". Be aware that the operators has no "weight". The calculation is done in the order of the operators.
Example:

45 + 34 * 2  = 158(which is the same as this is ordinary arithmetic: (45+34)*2=158 )*

Therefore I understood that it should be possible to perform the calculation in TScript.

I tried:

```typoscript
10.totalcost = TEXT
10.totalcost.value = 5*10
```

and the result is: '5*10' and not '50'. Therefore the multiplication did not work.....

I tried:

```typoscript
10.totalcost = +calc
10.totalcost.value = 5*10
```

but this leads to nothing....

I also tried:

```typoscript
lib.totalcost = COA_INT
lib.totalcost {
            10 = TEXT
            10.value = <label for="uid80">Totale kosten van deze bestelling</label>
            
            20 = CONTENT
            20.data = TSFE:fe_user|sesData|powermail_429|uid79
         }
```

In the powermail form the label is displayed. The second 'statement' should be something like:

1) get the user input from field uid79 on powermail page 429;
2) multiply this entry with a number
3) display this number in the powermail field uid80.

I did not include the multiplication because:
a) I do not know how to do arithmatic in TScipt;
b) I can not display the result back in a powermail field;

Could you provide a hint on how to perform the calculation in TScript? And how can I display the result in a powermail field?
thanks for any help,
regards,
Erwin

### [#4](https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question/4) · einpraegsam.​net · 2008-12-03

Hello Erwin,

I don't think that this is a newbie question.
I have invested some time and wrote a HOWTO:
[/d/84633-powermail-errechneter-wert-auf-antwortseite](https://www.typo3.net/d/84633-powermail-errechneter-wert-auf-antwortseite)

So I think you should spend a beer for this small HOWTO  :D

Alex

### [#5](https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question/5) · tanelkoth · 2008-12-03

Hi Alex,
many thanks for the example. I admit fully: this is something way beyond my league! And definitely you earned a beer! I hope the HOWTO will be of help to others as well.
Regards,
Erwin

---

Quelle: „Powermail: Help with Calculated fields - Newbie question“, typo3.net, https://www.typo3.net/d/84622-powermail-help-with-calculated-fields-newbie-question
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
