March 22, 200520 yr Hello, I am trying to query through a table record by record to add up a certain field of the records that qualify under the if statement: If ( qualification1 and qualification2 and qualification3; Sum ( add up certain field of all the records that made it through the if statement ) ; 0 ) However, the if statement goes through the first record only and, if it qualified, adds up all of the table's entries, regardless of whether they qualified individually. Is there a foreach statement or something similar I can use? Thanks.
March 22, 200520 yr Calulation field functions can only "see" data in their own record. They cannot see data in other records or the found set. (The GetSummary function is the only exception.) Summary fields can see found sets. So you want to make a summary fiels that sums a calculation field.
March 22, 200520 yr Author Thanks once again Vaughan. I don't think that a summary field will work, because there are multiple sorting criteria that would go into the field. More specifically, I am trying to keep a running sum of a field, should the underlying record have a qualifying content in three other fields. Should one of these three fields be different.... A B C D 1 1 2 10 1 1 3 13 1 2 2 5 2 1 3 9 2 2 1 14 2 1 3 10 Trying to summarize data in column D for each unique data in column A, if data in column B = 1, and for each unique data in column C: A C Summary 1 2 10 1 3 13 2 3 19 I have the sorting mechanism for columns A & C, but Summary is non-exclusive, so I get: A C Summary 1 2 61 1 3 61 2 3 61 (Sum of all of column D, since the 1 record meets the criteria. E.g. it simply sums everything if the first record qualifies) Is there anything more specific I can do?
March 22, 200520 yr You can create subsummary part when sorting by A&C and in preview mod get what you want.
March 23, 200520 yr Author Thanks for your responses. I think that I will go the self-join / relational route to maintain live data.
Create an account or sign in to comment