• 0 Vote(s) - 0 Average
  • 5
  • 4
  • 3
  • 2
  • 1
Thread Modes

Adding Values
#1
Good Morning, Everyone.

I'm curious if anyone here has had to add the results of multiple questions to get a total amount?  I'm assuming you need to use dynamic sql, but I'm just not sure where to begin in order to make this happen.  I need to add the results to three questions to get the total for the fourth.  If anyone has any suggestions, it would be greatly appreciated.

Thank You!
EV Noob, proud to be a member of EV CONNECT FORUM since Jan 2018.

#2
(05-10-2018, 10:31 AM)EV Noob Wrote: Good Morning, Everyone.

I'm curious if anyone here has had to add the results of multiple questions to get a total amount?  I'm assuming you need to use dynamic sql, but I'm just not sure where to begin in order to make this happen.  I need to add the results to three questions to get the total for the fourth.  If anyone has any suggestions, it would be greatly appreciated.

Thank You!

Hello,
You should likely store the sum of these three questions with an internal query step but you can't display result on a question unless you "insert" beforehand in SD_QUESTION_RESULT.

Sum can be like :

Code:
SELECT     SUM([40000].SD_QUESTION_RESULT.RESULT_NUMBER) AS t
FROM         [40000].SD_QUESTION_RESULT INNER JOIN
                     [40000].SD_QUESTION ON [40000].SD_QUESTION_RESULT.QUESTION_ID = [40000].SD_QUESTION.QUESTION_ID
WHERE     ([40000].SD_QUESTION_RESULT.REQUEST_ID IN @@ID@@) AND QUESTION_CODE IN ('Question1','Question2')

P.ABBE
ABBE Philippe, proud to be a member of EV CONNECT FORUM since Nov 2015.






Users browsing this thread: 1 Guest(s)