HTML5 Data Bindings Support Product Page

Answered

The sum of two fields into a text box?

Asked 18 Jul 2016 21:21:47
1
has this question
18 Jul 2016 21:21:47 Brad Lawryk posted:
I have a recordset that already has two fields with data. I need to be able to take the sum of those two fields and add it it as a default value to a form field.

I am sure this has been asked before but I can't find it. How do I retrieve the sum of two fields in a recordset?

Replies

Replied 19 Jul 2016 07:04:32
19 Jul 2016 07:04:32 Teodor Kuduschiev replied:
Hello Brad,
Is your field inside a repeat region? Is your data source containing one record or more? Which of the records you want to sum?
Replied 19 Jul 2016 13:20:58
19 Jul 2016 13:20:58 Brad Lawryk replied:
Two fields in one record inside a detail region.
Replied 19 Jul 2016 13:59:40
19 Jul 2016 13:59:40 Teodor Kuduschiev replied:
Then all you need is to add this as value for the field:


value="{{dbField1.toNumber() + dbField2.toNumber()}}"



Note, that you must have the formatter include on the page, in order to be able to use the toNumber() format. So just format some random value, and then remove the format from it, to just get the include.
Replied 19 Jul 2016 14:58:29
19 Jul 2016 14:58:29 Brad Lawryk replied:
Perfect! I was doing it correctly just didn't have a formatter on the page. Once I added that it worked perfectly. Thank you.

Reply to this topic