[英]Need help in view delegate in custom screen
我們創建了一個自定義屏幕,它根據過濾條件顯示銷售數據列表,例如(今天、昨天、本周、本月、本季度、今年),我們為此創建了 SQL 視圖,然后從我們創建的 VIEW 和 DAC 和在自定義屏幕中使用它。 我們的屏幕中也有過濾器。 對於過濾條件,我們使用視圖委托並返回數據。 問題是為什么屏幕加載 2K 記錄需要 70 秒左右的時間太長。 使用視圖委托會降低加載數據的速度。 我們可以使用 GI go,但我們需要在 GRID 中顯示圖像,因此我們選擇了自定義屏幕,並且我們在 header 中有一些報告按鈕,用於打印報告。 因為我們不能在 GI 中顯示圖像,所以我們選擇了這個。
您看到的緩慢很可能是由兩個原因共同造成的。
SelectWithViewContext
和DelegateResult
返回 object 而不是常規的 select。 在這種情況下,用戶過濾、分頁和排序保留在 select 中。 (僅當屏幕上的結果記錄與您 select 的記錄以 1 對 1 相關時使用此方法。如果您使用任何類型的聚合或插入來自 2 個不同 select 的記錄,則該方法不起作用)例子:
protected virtual IEnumerable ardocumentlist()
{
PXSelectBase<BalancedARDocument> cmd =
new PXSelectJoinGroupBy<BalancedARDocument,
...
OrderBy<Asc<BalancedARDocument.docType, //Set necessary sorting fields: use the key fields
Asc<BalancedARDocument.refNbr>>>> //Set necessary sorting fields: use the key fields
(this);
PXDelegateResult delegResult = new PXDelegateResult
{
IsResultFiltered = true, //set these fields to indicate that the result does not need re-filtering, resorting and re-paging
IsResultTruncated = true,
IsResultSorted = true
}
foreach (PXResult<BalancedARDocument> res_record in cmd.SelectWithViewContext())
{
// add the code to process res_record
delegResult.Add(res_record);
}
return delegResult;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.