Announcements
Hello All,
I am facing one concern in MS Dynamics CRM where we are using one Virtual Entity and showing its data as a subgrid in Account Entity.
Problem is, we have set per page record limit to 20 in the grid(which cannot be changed or increased). If we get the data of more than 20 records, remaining records move to next page.
But however, we are not able to move to next page in this subgrid. Any idea to resolve this would be very helpful. Neither the sorting and filter works.
how did you get your records in a subgrid
"Although you can add virtual table columns as a lookup on a grid or other UI views, you cannot filter or sort based on this virtual table lookup column. "
If I want to show records in subfrid the list is empty while I can show the total list
Did you get resolution to this issue?
Hi Vishal,
Did you solved the paging issue? If yes, would you like to share it?
I am using virtual connector in dataverse to create virtual entity and facing same paging issue. To me it seems paging is not implemented in virtual connector.
Thanks,
Adnan
Hello,
you need to develop all pagination handling, interpreting the queryexpression pageinfo received in the plugin.
Reading the pageinfo:
if (query.PageInfo != null)
{
pageNumber = query.PageInfo.PageNumber;
pageSize = query.PageInfo.Count;
offset = $" OFFSET {(pageNumber - 1) * pageSize} ROWS FETCH NEXT {pageSize + 1} ROWS ONLY";
}
Editing the SQL query with the offset and doing a count query...:
command.CommandText = $"SELECT FIELDS FROM TABLE{orderString}{offset}";
queryCount = $"SELECT COUNT(*) FROM TABLE";
Informing the entity collection about the presence of new records:
if (readerCount.HasRows)
{
while (readerCount.Read())
if (!readerCount.IsDBNull(0)) total = readerCount.GetInt32(0);
collection.MoreRecords = total > pageNumber * pageSize;
collection.PagingCookie = "<cookie page='" + pageNumber + "'> <ENTITY_NAME last='{" + collection.Entities[collection.Entities.Count - 1].Id + "}' first='{" + collection.Entities[0].Id + "}' /> </cookie>";
collection.TotalRecordCount = total;
}
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156