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.

Top N Report For a Date Range

Featured Replies

I have a call center database. There are 2 tables: CALLS & PRODUCTS. Each call that comes into the center gets a new call record. Each CALL record is related to a PRODUCT record. Each PRODUCT can be related to many CALLS but each CALL can only be related to one PRODUCT.

I have been asked to produce a report that shows the top [variable] PRODUCTS that have had the most calls occuring from [variable] thru [variable].

(the user will enter the variables when prompted)

For example; the user would want to see the 5 products that had the greatest number of calls between January 1st and March 31st this year.

I'm having trouble with the "Top N" portion of the task. Using a summary field I can get a count of the products (I'm running this from the CALLS table) but I can't get it ordered properly nor can I exclude the "bottom N"

I have a feeling that I am coming at this completely from the wrong direction. All help is appreciated.

-Becky

A rough sketch:

In Products, 3 global fields: gStartDate, gEndDate, gN.

A new TO of Calls, named CallsInRange.

Relationship:

Products::ProductID = CallsInRange::ProductID

AND

Products::gStartDate ≤ CallsInRange::Date

AND

Products::gEndDate ≥ CallsInRange::Date

In Products, a calculation field, cCountInRange (result is number) =

Count ( CallsInRange::CallID )

Script:

Go to Layout [ "Report" (Products) ]

Show All Records

Sort Records [ Specified Sort Order: Products::cCountInRange ; descending ]

Go to Record/Request/Page [ Products::gN + 1 ]

Omit Multiple Records [ Get ( FoundCount ) - Products::gN ]

Enter Preview Mode [ Pause ]

Enter Browse Mode Go to Layout [ original layout ]

Show All Records

This needs a bit more work to handle a tie for the last place.

I was working on an example while Comment was making a reply. His way of limiting the found set with:

Go to Record/Request/Page [ Products::gN + 1 ]

Omit Multiple Records [ Get ( FoundCount ) - Products::gN ]

is much more efficient than the way I was planning. I used a Go To Field script step as the first step, otherwise If N was the last field I was in then a change to N did not seem to always take.

ProdsCalls.zip

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.