Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mark3grahams opened this issue Dec 22, 2023 · 1 comment
Open

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

mark3grahams opened this issue Dec 22, 2023 · 1 comment

Comments

@mark3grahams
Copy link

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...

@gdbarron
Copy link
Collaborator

Have you confirmed type looks as expected?

Get-ServiceNowRecord -Table 'change request' -Filter @('opened_at', '-between', (Get-Date).AddMonths(-2), (Get-Date)) -IncludeTotalCount | Select -Property type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants