4 Replies Latest reply: Feb 15, 2018 6:59 AM by Saimeenakshi Sankar RSS

    Is it possible to add calculation expressions in Main content?

    Saimeenakshi Sankar

      Hi All,

       

      I Wanted to display summary of values in my mail body. How to achieve that?

       

      Thank you,

      Regards,

      Sai

        • Re: Is it possible to add calculation expressions in Main content?
          Johan Lindell

          Hi,

           

          Are you referring to the "Alert" email functionality? If so yes, just make an expression, same as you would on a text box like this:

           

          'Sales this week ' & Num (Sum ({<Date = {">=$(=WeekStart (Today()))"}>} Sales), '# ##0', ',', ' ')

            • Re: Is it possible to add calculation expressions in Main content?
              Saimeenakshi Sankar

              Hi I have tried the above, but it is not working. The formula is not getting resolved into a value.

               

               

               

              P.S. I have added 3 calculations in the mail content and First line of the mail is a notification sentence.

               

              Regards,
              Sai

                • Re: Is it possible to add calculation expressions in Main content?
                  Johan Lindell

                  Hi,

                   

                  Have you tried to put the formula in to a Text box to see if it works? You have to start with an equal sign (or a dollar-expansion?):

                  ='Sales this week ' & Num (Sum ({<Date = {">=$(=WeekStart (Today()))"}>} Sales), '# ##0', ',', ' ')


                  If the above does not work then there is something wrong. You could also put the message into a variable and use the variable.


                  SubjectSales:

                  LOAD Sum (Sales) as SalesThisWeek

                  Resident Invioces

                  Where Date >= WeekStart (Today ())

                   

                  LET SubjectSales = 'Sales this week ' & Num (Peek ('SalesThisWeek', 0, 'SubjectSales'), '# ##0', ',', ' ');


                  DROP Table SubjectSales;


                  and then set the subject to =SubjectSales


                  I usually make a page with textboxes for recipients, conditions, subject and messages. Then I create variables for these and check that the formulas are working OK. And then use the formulas in the Alerts.


                  Example:

                  Variable: vL.AlertNetSalesSubject

                  Formula: 'Net Sales ' & Capitalize (Date (Today () - 1, 'MMMM')) & ' '& Year (Today () - 1) & ': ' & Num(Sum ({$<Year = {'$(=Year (Today () - 1))'}, Month = {'$(=Month (Today () - 1))'}, [Sales type] = {'Product sales'}>}  [Net amount company currency])/1000000, '0,0' & ' MSEK')

                  Textbox: =$(vL.AlertNetSalesSubject)

                  Alert Subject: =$(vL.AlertNetSalesSubject)

                   

                  The above works. Checking that it works in a text box makes sure you get the '-characters right and the $-expansions correct.

                   

                  Good luck!

                  Johan