<![CDATA[ How to add values of two TVs - My Forums]]> https://forums.modx.com/thread/?thread=45338 <![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-455012
[*initialpayment:math=`?+[*finalpayment*]`*]

Replacing the * by + does not work.
I tried to disable PHx as I read there is already built-in PHx in Ditto.
]]>
Jul Feb 13, 2013, 10:45 AM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-455012
<![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-416316
<script type="text/javascript">
sum = function(o){
	for(var s = 0, i = o.length; i; s += o[--i]);
	return s;
};

var x = [ [[!getImageList? 
    &tvname=`mig`
&outputSeparator=`,`
    &tpl=`@CODE:[[+num]]
  `]] ];
document.write(sum(x));


</script>


where num is a tv usd in migx holding a numerical value.

]]>
howster Mar 16, 2012, 02:18 PM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-416316
<![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-416288 Any idea how u would add fields in Migx together. Say I have a field "number". I would like the user to add as many rows with values they want and at the end it would be totalled.
Thanks]]>
howster Mar 16, 2012, 10:34 AM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-416288
<![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261872
You were right on. Turns out the TVs contain $50.00 and $250.00 rather than pure numeric values.

Once I removed those $s, worked like a charm!

Thank you!]]>
Terry Mar 29, 2009, 03:03 PM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261872
<![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261871
i checked it out. created 2 Tvs . added them. it worked as expect.

PAGECONTENT
[*initialpayment*]
[*finalpayment*]
[*initialpayment:math=`?+[*finalpayment*]`*]

RENDERED CONTENT
5.54
2.00
7.54

I haven’t got a clue why it is not working.
Do you got any orphan tags or backticks somewhere in your content?


]]>
mirko Mar 29, 2009, 02:35 PM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261871
<![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261870
Thanks for responding so quickly.

Here’s what I get with your example.

Parse error: syntax error, unexpected T_DNUMBER, expecting T_VARIABLE or ’$’ in /home/xxxxxxx/public_html/assets/plugins/phx/phx.parser.class.inc.php(266) : eval()’d code on line 1]]>
Terry Mar 29, 2009, 02:01 PM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261870
<![CDATA[Re: How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261869
[*initialpayment:math=`?+[*finalpayment*]`*]

]]>
mirko Mar 29, 2009, 01:30 PM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261869
<![CDATA[How to add values of two TVs]]> https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261868
I would like to display a value on page which is simply two TVs added together.

I have a TV called initialpayment and another called finalpayment.  I want to add them together and display on a page.

I’ve never used PHX before.  I’m assuming this is a job for PHX?  I suspect I’m stuck on the syntax.  I’ve tried about a hundred variations can’t seem to get it right.  I get either a parse error or no value is displayed.  Can someone show me how its done?

Here’s the latest I’ve tried.

<p>[*projectcost:math?`[*initialpayment*]+[*finalpayment*]`*]</p>]]>
Terry Mar 29, 2009, 01:04 PM https://forums.modx.com/thread/45338/how-to-add-values-of-two-tvs#dis-post-261868