Skip to content

Commit 05ac6af

Browse files
committed
Improving record counts #153
1 parent 16fbcc4 commit 05ac6af

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

FetchXmlBuilder/AppCode/QueryInfo.cs

+3-9
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,8 @@ public QueryBase Query
3131
fetchdoc.LoadXml(fetch.Query);
3232
if (fetchdoc.SelectSingleNode("fetch") is XmlElement fetchnode)
3333
{
34-
if (fetchnode.AttributeInt("count") is int count)
35-
{
36-
PageSize = count;
37-
}
38-
if (fetchnode.AttributeInt("page") is int page)
39-
{
40-
PageNo = page;
41-
}
34+
PageSize = Math.Min(fetchnode.AttributeInt("count") ?? 5000, 5000);
35+
PageNo = fetchnode.AttributeInt("page") ?? 1;
4236
}
4337
}
4438
}
@@ -60,7 +54,7 @@ public EntityCollection Results
6054
PageNo = page;
6155
}
6256
}
63-
if (result.TotalRecordCount > -1 && PageSize > 0)
57+
if (result.TotalRecordCount > -1 && result.TotalRecordCount < 5000 && PageSize > 0 && result.TotalRecordCount > PageSize)
6458
{
6559
Pages = (int)Math.Ceiling((decimal)result.TotalRecordCount / PageSize);
6660
}

FetchXmlBuilder/DockControls/ResultGrid.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal void SetData(QueryInfo queryinfo)
5959
if (queryinfo.RecordFrom > 1 || queryinfo.Results.MoreRecords)
6060
{
6161
mnuRecordsNumbers.Text = $"Records: {queryinfo.RecordFrom}-{queryinfo.RecordTo}";
62-
if (queryinfo.Results.TotalRecordCount > 0)
62+
if (queryinfo.Results.TotalRecordCount > 0 && queryinfo.Results.TotalRecordCount < 5000)
6363
{
6464
mnuRecordsNumbers.Text += $" ({queryinfo.Results.TotalRecordCount})";
6565
}

0 commit comments

Comments
 (0)