Skip to content

Commit

Permalink
Improving record counts #153
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Aug 13, 2023
1 parent 16fbcc4 commit 05ac6af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions FetchXmlBuilder/AppCode/QueryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@ public QueryBase Query
fetchdoc.LoadXml(fetch.Query);
if (fetchdoc.SelectSingleNode("fetch") is XmlElement fetchnode)
{
if (fetchnode.AttributeInt("count") is int count)
{
PageSize = count;
}
if (fetchnode.AttributeInt("page") is int page)
{
PageNo = page;
}
PageSize = Math.Min(fetchnode.AttributeInt("count") ?? 5000, 5000);
PageNo = fetchnode.AttributeInt("page") ?? 1;
}
}
}
Expand All @@ -60,7 +54,7 @@ public EntityCollection Results
PageNo = page;
}
}
if (result.TotalRecordCount > -1 && PageSize > 0)
if (result.TotalRecordCount > -1 && result.TotalRecordCount < 5000 && PageSize > 0 && result.TotalRecordCount > PageSize)
{
Pages = (int)Math.Ceiling((decimal)result.TotalRecordCount / PageSize);
}
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/DockControls/ResultGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal void SetData(QueryInfo queryinfo)
if (queryinfo.RecordFrom > 1 || queryinfo.Results.MoreRecords)
{
mnuRecordsNumbers.Text = $"Records: {queryinfo.RecordFrom}-{queryinfo.RecordTo}";
if (queryinfo.Results.TotalRecordCount > 0)
if (queryinfo.Results.TotalRecordCount > 0 && queryinfo.Results.TotalRecordCount < 5000)
{
mnuRecordsNumbers.Text += $" ({queryinfo.Results.TotalRecordCount})";
}
Expand Down

0 comments on commit 05ac6af

Please sign in to comment.