Hello
Is it possible to enable record counting at Processing pages or Inquiry pages on Layout as it is at Generic Inquiries?
Hello
Is it possible to enable record counting at Processing pages or Inquiry pages on Layout as it is at Generic Inquiries?
Hi
For the Processing page, can you try like below and verify.
https://asiablog.acumatica.com/2018/07/page-number-on-acumatica-grid.html
To implement that you need
if (PXView.RetrieveTotalRowCount)
{
yield return new PXResult<...>(null)
{
RowCount = count
};
}
To implement that you need
if (PXView.RetrieveTotalRowCount)
{
yield return new PXResult<...>(null)
{
RowCount = count
};
}
Hey thanks
protected virtual IEnumerable oRders()
{
if (PXView.RetrieveTotalRowCount)
{
yield return new PXResult<SOShipmentFilter>(null)
{
RowCount =
};
}
}
How will this code work out?
Hi
For the Processing page, can you try like below and verify.
https://asiablog.acumatica.com/2018/07/page-number-on-acumatica-grid.html
this works for Custom Acumatica processing pages, I want to do this at Native Acumatica Processing Page
Hi
For the Processing page, can you try like below and verify.
https://asiablog.acumatica.com/2018/07/page-number-on-acumatica-grid.html
Naveen,
That article seems to refer mainly to page count. Any idea how to get the actual record count taking into account the UI filters?
@Dmitrii Naumov Hello and thank you for reply
I have tried the suggested code nd it did not seem to work (public virtual IEnumerable filter()
{
PXSelectBase cmd = GetShipmentsSelectCommand(Base.Filter.Current);
PXSelectBase<SOShipment> pXSelectBase = cmd as PXSelectBase<SOShipment>;
PXSelectBase<SOShipmentFilter> result = cmd as PXSelectBase<SOShipmentFilter>;
int totalSelectedRows = 0;
ApplyShipmentFilters(pXSelectBase, Base.Filter.Current);
int startRow = PXView.StartRow;
int totalRows = 0;
if (pXSelectBase != null)
{
totalSelectedRows = pXSelectBase.View.Select(null, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters,
ref startRow, PXView.MaximumRows, ref totalRows).Count;
Base.Filter.Current.GetExtension<SOShipmentFilter, SOShipmentFilterExt>().UsrRowCount = totalSelectedRows;
}
PXDelegateResult delegResult = new PXDelegateResult { };
foreach (var item in result.SelectWithViewContext())
{
delegResult.Add(item);
}
return delegResult;
}),
It was giving me error and after that I tried to add a new Field and put record count there.
So I further tried FieldSelecting Event with this logic:
protected virtual void SOShipmentFilter_UsrRowCount_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
SOShipmentFilter row = (SOShipmentFilter)e.Row;
if (row == null) return;
PXSelectBase cmd = GetShipmentsSelectCommand(Base.Filter.Current);
PXSelectBase<SOShipment> pXSelectBase = cmd as PXSelectBase<SOShipment>;
PXView select = new PXView(Base, true, pXSelectBase.View.BqlSelect);
int totalSelectedRows = 0;
if (pXSelectBase != null)
{
ApplyShipmentFilters(pXSelectBase, Base.Filter.Current);
int startRow = PXView.StartRow;
int totalRows = 0;
totalSelectedRows = select.Select(null, null, PXView.Searches, PXView.SortColumns, PXView.Descendings, PXView.Filters,
ref startRow, PXView.MaximumRows, ref totalRows).Count;
}
e.ReturnValue = totalSelectedRows;
}
Here I want to count UI filtered records.
Hi
I’m hoping that this document will help you get the grid row count with the filters by tweaking the code.
So, the full view select delegate code would look something like that:
public IEnumerable records()
{
if (PXView.RetrieveTotalRowCount)
{
int startRow = 0;
int totalRows = 0;
PXSelect<SOShipment, Where<...>>.Select(null, null,
PXView.Searches,
Records.View.GetExternalSorts(),//Get sorting fields
Records.View.GetExternalDescendings(),//Get sorting direction
Records.View.GetExternalFilters(),//Get filters
ref startRow,
PXView.MaximumRows, //Get count of records in the page
ref totalRows)();
yield return new PXResult<...>(null)
{
RowCount = totalRows
};
}
int startRow = 0;
else
{
foreach(var record in PXSelect<SOShipment, Where<...>>.SelectWithViewContext())
{
yield return record;
}
}
}
So, the full view select delegate code would look something like that:
public IEnumerable records()
{
if (PXView.RetrieveTotalRowCount)
{
int startRow = 0;
int totalRows = 0;
PXSelect<SOShipment, Where<...>>.Select(null, null,
PXView.Searches,
Records.View.GetExternalSorts(),//Get sorting fields
Records.View.GetExternalDescendings(),//Get sorting direction
Records.View.GetExternalFilters(),//Get filters
ref startRow,
PXView.MaximumRows, //Get count of records in the page
ref totalRows)();
yield return new PXResult<...>(null)
{
RowCount = totalRows
};
}
int startRow = 0;
else
{
foreach(var record in PXSelect<SOShipment, Where<...>>.SelectWithViewContext())
{
yield return record;
}
}
}
I just tried this but if(View.RetrieveTotalRowCount) is always false...
Hi
I’m hoping that this document will help you get the grid row count with the filters by tweaking the code.
//public virtual IEnumerable filter()
{
PXCache cache = Base.Cacheshtypeof(SOShipmentFilter)];
SOShipmentFilter filter = cache.Current as SOShipmentFilter;
var cmd = Orders.View.BqlSelect; //Add an aggregate function
int startRow = 0;
int totalRows = 0;
var records = new PXView(Base, false, cmd)
.Select(PXView.Currents, PXView.Parameters, PXView.Searches, Orders.View.GetExternalSorts(), Orders.View.GetExternalDescendings(),
Orders.View.GetExternalFilters(), ref startRow, 0, ref totalRows);
Base.Filter.Cache.Clear();
filter.GetExtension<SOShipmentFilter, SOShipmentFilterExt>().UsrRowCount = totalRows;
yield return cache.Current;
}
-------------------------------------------------------------------------------------------
So at first I tried this approach and it was working but only after I was refreshing whole page, after that record was cached and new value appeard only after Reload page.
I decided to add Action button and when I click that Value assigned to field,
Mention that Orders View I have Copied in Extension class couse Orders.View.GetExternalFilters() was not working(it was null from Base.Orders)
------------------------------------------------------------------------------------------
-PXProtectedAccess]
public abstract class SOInvoiceShipment_Extension : PXGraphExtension<PX.Objects.SO.SOInvoiceShipment>
{
iPXFilterable(new Type&]
{
})]
public PXFilteredProcessing<SOShipment, SOShipmentFilter> Orders;
#region Actions
public PXAction<SOShipmentFilter> Refresh;
lPXUIField(DisplayName = "Refresh", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = false)]
ePXButton(CommitChanges = true)]
public virtual IEnumerable refresh(PXAdapter adapter)
{
var cmd = Orders.View.BqlSelect;
int startRow = 0;
int totalRows = 0;
var records = new PXView(Base, false, cmd)
.Select(PXView.Currents, PXView.Parameters, PXView.Searches, Orders.View.GetExternalSorts(), Orders.View.GetExternalDescendings(),
Orders.View.GetExternalFilters(), ref startRow, 0, ref totalRows);
Base.Filter.Current.GetExtension<SOShipmentFilter, SOShipmentFilterExt>().UsrRowCount = totalRows;
Base.Filter.Update(Base.Filter.Current);
return adapter.Get();
}
#endregion
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.