Mandu Posted March 15, 2005 Author Posted March 15, 2005 How does one determine the number of unique values in a field in a found set? That's the question! I found a recipe in FM Help for finding duplicate values via a self-join, which might be extendible to solve this, but I wondered if there was a simple, direct solution. Odd that I can't find this question in the archives. Gratefully, Chap
Mandu Posted March 15, 2005 Posted March 15, 2005 How does one determine the number of unique values in a field in a found set? That's the question! I found a recipe in FM Help for finding duplicate values via a self-join, which might be extendible to solve this, but I wondered if there was a simple, direct solution. Odd that I can't find this question in the archives. Gratefully, Chap
Mandu Posted March 15, 2005 Author Posted March 15, 2005 Thanks, Queue - I may be mistaken, but the solutions discussed in that thread all seem to generate the distinct values in the entire database. What I need is the distinct values of a field IN A FOUND SET. Techniques involving Insert from Index, or (SerialNo = SelfJoinRel::SerialNo), seem to be valid only for the entire database. If I'm missing a subtlety, please enlighten me! :-) Thanks, Chap
Mandu Posted March 15, 2005 Author Posted March 15, 2005 Thanks, Queue - I may be mistaken, but the solutions discussed in that thread all seem to generate the distinct values in the entire database. What I need is the distinct values of a field IN A FOUND SET. Techniques involving Insert from Index, or (SerialNo = SelfJoinRel::SerialNo), seem to be valid only for the entire database. If I'm missing a subtlety, please enlighten me! :-) Thanks, Chap
aaa Posted March 15, 2005 Posted March 15, 2005 If you want have foundset, the most quickly way to get it is to export records to enother file choosing summary by your field. This tecnique works such as DISTINCT in SQL.SerialNo = SelfJoinRel::SerialNo works slowly when i tried.
aaa Posted March 15, 2005 Posted March 15, 2005 If you want have foundset, the most quickly way to get it is to export records to enother file choosing summary by your field. This tecnique works such as DISTINCT in SQL.SerialNo = SelfJoinRel::SerialNo works slowly when i tried.
comment Posted March 15, 2005 Posted March 15, 2005 No, you are correct. Only summary fields operate on the found set. But a summary field will not give you a count of distinct. I believe you need to script this.
comment Posted March 15, 2005 Posted March 15, 2005 No, you are correct. Only summary fields operate on the found set. But a summary field will not give you a count of distinct. I believe you need to script this.
aaa Posted March 15, 2005 Posted March 15, 2005 I use it, and using this technology i have a found set of records with unique values in product_Id field from lineitem file. You must choosing "summary by" when exporting.
aaa Posted March 15, 2005 Posted March 15, 2005 I use it, and using this technology i have a found set of records with unique values in product_Id field from lineitem file. You must choosing "summary by" when exporting.
Mandu Posted March 15, 2005 Author Posted March 15, 2005 I hoped to find a general way to implement DISTINCT, but perhaps it's not worth it at this point. Here's the specific problem I'm trying to solve: It's an Orders/LineItems database. I've done a Find against LineItems to get a found set of all purchases of a certain type of product. The question is: how many Orders does this represent? I was trying to count the distinct values for the foreign key Order_ID. Perhaps, for this particular problem, there is a different approach I should consider?
Ender Posted March 15, 2005 Posted March 15, 2005 You can do this with the getsummary() function. See my first response in this thread: http://forum.filemakerworld.com/viewtopic.php?t=6225
Mandu Posted March 15, 2005 Author Posted March 15, 2005 Gee. I might not have thought of that Thanks. Quite weird, and slow computing the total of those fractions based on getsummary(), but it works. For future reference, the post by Ender points to a technique for reporting a COUNT of DISTINCT values of a field in a FOUND SET
Recommended Posts
This topic is 7250 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now