Skip to content

Number of records different when using the filter vs where. #258

@mark3grahams

Description

@mark3grahams

Hi,

I am a bit new to this module, and I am wondering why I am getting different results.

Get-ServiceNowRecord -Table 'change request' -Filter @('opened_at', '-between', (Get-Date).AddMonths(-2), (Get-Date)), '-and', @('type', '-eq', 'Normal') -IncludeTotalCount
WARNING: Getting 5 records...

number short_description state assigned_to approval cmdb_ci opened_at


CHG0070484 Add/Remove users from ... New John Smith Not Yet... 11-20-2023 02:19:1...
CHG0070489 New John Smith Not Yet... 11-20-2023 02:51:3...
CHG0070490 New John Smith Not Yet... 11-20-2023 02:55:4...
CHG0070495 New John Smith Not Yet... 11-20-2023 03:28:1...
CHG0070496 New John Smith Not Yet... 11-20-2023 03:28:3...

Get-ServiceNowRecord -Table 'change request' -Filter @('opened_at', '-between', (Get-Date).AddMonths(-2), (Get-Date)) -IncludeTotalCount | Where-Object { $_.type -eq 'Normal' }
WARNING: Getting 36 records...

number short_description state assigned_to approval cmdb_ci opened_at


CHG0070484 Add/Remove users from ... New John Smith Not Yet... 11-20-2023 02:19:1...
CHG0070489 New John Smith Not Yet... 11-20-2023 02:51:3...
CHG0070490 New John Smith Not Yet... 11-20-2023 02:55:4...
CHG0070491 Test New John Smith Requested 11-20-2023 03:23:5...
CHG0070495 New John Smith Not Yet... 11-20-2023 03:28:1...
CHG0070496 New John Smith Not Yet... 11-20-2023 03:28:3...
CHG0070515 test New John Doe Approved 12-19-2023 12:01:5...
CHG0070516 test New Jane Doe Requested 12-19-2023 01:54:5...
CHG0070517 test New Jane Doe Requested 12-19-2023 02:00:0...
CHG0070518 test New John Doe Approved 12-19-2023 02:02:0...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions