Hi everyone,

Im trying to run a an an ExecuteSQL calculation that counts the unique SSN in a found set, this is the calculation im using:

ExecuteSQL ("SELECT COUNT ( DISTINCT SSN) FROM \"36 Contributions \" " ; "" ; "" )

SSN is the Field name

36 Contributions is the Table name

I'm placing the calculation in the Trailing Grand Summary, not sure why i'm not getting any results

Any help would be appreciated thank you!

1. this would work:

ValueCount( ExecuteSQL(" SELECT DISTINCT ssn FROM \"36 Contributions\" " ; "" ; "" ) )

Since you are returning a return-delimited list from one field. ValueCount will tell you how many values in the list.

2. although, your query should be correct

http://help.filemaker.com/app/answers/detail/a_id/3423/~/counting-the-number-of-unique-values-in-a-field

3. you can place EvaluationError() around your ExecuteSQL() and if it returns an error code, let us know.

4. also, this article is useful, if you have FMProAdvanced for using the DataViewer:

https://www.teamdf.com/blogs/unlocking-hidden-error-messages-in-the-executesql-function/

beverly