Jump to content
  • 0

Sql Calculation Question


eetimm

Question

I am trying to make a SQL calculation in a HTML data page, to display the sum of points attained by the logged-in group member. 

 

My SQL statement, in a calculated field, is:

 

select
sum(Points)
from Activity_Table
where Activity_Table.Member_ID = [@field:Member_ID]

 

If I manually set the member_ID field in the formula (e.g. Activity_Table.Member_ID = 103), the formula works correctly, but when I try it as shown above my result is the sum of ALL points regardless of member.  I am assuming that there is some problem passing the field value correctly, but I can't figure it out.  Anyone have any thoughts?  Thanks!!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Where do you want to have this formula? Details or report? Is it aggregation or calculated field? You do not need to include the member ID since for each record system can recognize the ID. In aggregation you can use the field name to refer to it with not [@field:   ]

 

So you can refer to it in this format where Activity_Table.Member_ID = Member_ID

Link to comment
Share on other sites

  • 0

Thanks for the response....I was afraid that my question was not that clear....

 

I am using this formula in a HTML data page, and it is in a calculated field.  I can get the field to calculate correctly when actually put the Member_ID in the formula, but when I try to reference the field the calculation returns the total of all members. 

 

I tried your suggestion of directly using the field in the formula (replacing [@field:Member_ID] with just Member_ID) but this had the same result.

 

I will keep trying alternatives.

 

Thanks for your help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...