solved Adding math equations to variables

alt=
duke
@musamensa
7 years ago
253 posts
Hi, i have assigned values to two different variables and i would like to add those separate variables and have the sum printed. here is what i have tried but its not working.

cheers

{jrCore_get_count module="jrAudio" name="audio_file_stream" profile_id=$_profile_id value="audiostreams"}

{jrCore_get_count module="jrYouTube" name="youtube_stream" profile_id=$_profile_id value="videostreams"}

{math equation="x + y" x=$audiostreams y=$videostreams}
updated by @musamensa: 12/25/17 12:42:58PM
paul
@paul
7 years ago
4,326 posts
You need to use 'assign', not 'value'. Also, you can do the addition directly in the smarty call, so -

{jrCore_get_count module="jrAudio" name="audio_file_stream" profile_id=$_profile_id assign="audiostreams"}

{jrCore_get_count module="jrYouTube" name="youtube_stream" profile_id=$_profile_id assign="videostreams"}

{$x=$audiostreams + $videostreams}

hth


--
Paul Asher - JR Developer and System Import Specialist
alt=
duke
@musamensa
7 years ago
253 posts
thanks, but is not working showing error on page HTTP error 500
paul
@paul
7 years ago
4,326 posts
Working ok for me - http://pauldevcom.jamroomhosting.com/mathtest
Here is my template code -
{jrCore_get_count module="jrAudio" name="audio_file_stream_count" assign="audiostreams"}
Audio Streams: {$audiostreams}<br>
{jrCore_get_count module="jrYouTube" name="youtube_stream_count" assign="videostreams"}
Video Streams: {$videostreams}<br>
{$x = $audiostreams + $videostreams}
Total Streams: {$x}<br>



--
Paul Asher - JR Developer and System Import Specialist
alt=
duke
@musamensa
7 years ago
253 posts
thank work just fine

Tags