Saturday, November 17, 2018

Search with Summary Type Set to Count Shows Incorrect Result


User creates a Saved Search (e.g. Phone Call) and in the Results tab > Columns subtab used a Summary Type of Count for the Date Field.

User needs to count the unique number of Phone Calls made base on the Phone Call Date. When viewing the result, the user is not getting the expected result. The count in the Result is more than the actual count of unique date.

This behavior is caused by the Date/Time format of the field. In the UI, the field appears as Date only. However, in the back-end the field is evaluated as Date/Time. Hence, when using Summary Type: Count, the result is counted by Date and by Time. For example:

Phone Call Record

Phone Call Date

Phone Call 1

1/1/2012

Phone Call 2

1/1/2012

Phone Call 3

1/1/2012

Phone Call 4

1/2/2012

Phone Call 5

1/3/2012

Base from the example above, the expected Count of Phone Call Date is 3.

The system evaluates the field as:

Phone Call Record

Phone Call Date

Phone Call 1

1/1/2012 1:00:00 AM

Phone Call 2

1/1/2012 1:00:00 AM

Phone Call 3

1/1/2012 2:00:00 AM

Phone Call 4

1/2/2012 4:00:00 AM

Phone Call 5

1/3/2012 3:00:00 AM

Hence, result shows 4 instead of 3.

To resolve this, use the to_char formula to return only the Date portion of the field.

    1. Navigate to Lists > Search > Saved Searches > New.

    2. Select Type (e.g. Phone Call).

    3. Provide Title.

    4. Click the Results tab > Columns subtab.

    5. Add Formula (Text).

    6. In the Formula use: to_char({startdate},'MM/DD/YYYY')

    7. Set Summary Type to Count.

    8. Add other required fields.

    9. Click Save & Run.

Note: For other date fields of type Date, a formula is no longer necessary. The Function can be set to Day in addition to the Count Summary Type to achieve this type of counting.

No comments:

Post a Comment