Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Counting unique values

Featured Replies

  • Author

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

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

  • Author

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

  • Author

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

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.

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.

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.

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.

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.

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.

  • Author

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?

  • Author

Gee. I might not have thought of that grin.gif

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

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.