Show Arrived quantity on Buyer Workbench

Our buyers would like to be able to see Arrived status on Buyer Workbench. The grids in on the screen don’t show all the PORel fields; it looks like they are calculated / pulled from a temporary table.

So to show the Arrived column here, I suppose it would have to be done with custom code?
Is this the direction I need to go? Looks like a LOT of work…
Or do yall know of a better/easier way? Thank you

Sheepish post here. Right answer is to replace the grids with a BAQ per @josecgomez’s guide:

Wrong answer is to spend all day cobbling together code to add the columns to the grids. There are ~50 posts on how to do it the wrong way. And they are all outdated; BOReader is used differently now. Here are some decent posts FFR:

And here is the code I came up with, if anyone else wants it…

// **************************************************
// Custom code for BWForm
// Created: 5/4/2022 1:53:14 PM
// **************************************************

using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

using Ice.Proxy.Lib;  //for BOReader

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	private BOReaderImpl _boReader;
	EpiUltraGrid ugdLate; //ugdLate 7165b214-eac4-4184-8d1e-3c9770bfc022
	EpiUltraGrid ugdToday; //ugdToday 3232d1b3-82e5-475b-9d11-f230438a0036
	EpiUltraGrid ugdThisWeek; //ugdThisWeek  1b6e1fdd-36dd-4a61-9333-061cca6b70d4
	//EpiUltraGrid ugdFuture; //ugdFuture  5ad70697-7a4c-456c-8ef8-e5866dde0e0a
     
	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls

		//Add Qty Arrived columns to the 4 grids

		ugdLate = (EpiUltraGrid)csm.GetNativeControlReference("7165b214-eac4-4184-8d1e-3c9770bfc022");
		ugdToday = (EpiUltraGrid)csm.GetNativeControlReference("3232d1b3-82e5-475b-9d11-f230438a0036");
		ugdThisWeek = (EpiUltraGrid)csm.GetNativeControlReference("1b6e1fdd-36dd-4a61-9333-061cca6b70d4");
		//ugdFuture = (EpiUltraGrid)csm.GetNativeControlReference("5ad70697-7a4c-456c-8ef8-e5866dde0e0a");

		ugdLate.DisplayLayout.Bands[0].Columns.Add("ArrivedQty","Arrived Qty");				
		ugdLate.DisplayLayout.Bands[0].Columns["ArrivedQty"].Hidden = false;		
		ugdLate.DisplayLayout.Bands[0].Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
		ugdToday.DisplayLayout.Bands[0].Columns.Add("ArrivedQty","Arrived Qty");
		ugdToday.DisplayLayout.Bands[0].Columns["ArrivedQty"].Hidden = false;
		ugdToday.DisplayLayout.Bands[0].Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
		ugdThisWeek.DisplayLayout.Bands[0].Columns.Add("ArrivedQty","Arrived Qty");
		ugdThisWeek.DisplayLayout.Bands[0].Columns["ArrivedQty"].Hidden = false;
		ugdThisWeek.DisplayLayout.Bands[0].Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
		//Future table has noticeable performance hit, may be hundreds of POs in this list.
		//ugdFuture.DisplayLayout.Bands[0].Columns.Add("ArrivedQty","Arrived Qty");
		//ugdFuture.DisplayLayout.Bands[0].Columns["ArrivedQty"].Hidden = false;
		//ugdFuture.DisplayLayout.Bands[0].Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;

		ugdLate.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		ugdToday.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		ugdThisWeek.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		//ugdFuture.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		_boReader = WCFServiceSupport.CreateImpl<BOReaderImpl>((Ice.Core.Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.BOReaderSvcContract>.UriPath);
	}

	private void POList_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
	{
		if(!String.IsNullOrEmpty(e.Row.Cells["PONum"].Value.ToString()))
		{
			string PONum = Convert.ToString(e.Row.Cells["PONum"].Value);
			string POLine = Convert.ToString(e.Row.Cells["POLine"].Value);
			string PORelNum = Convert.ToString(e.Row.Cells["PORelNum"].Value);
			try {
				//BO Reader call method for Epicor 2021.2.13...
				DataSet ds = _boReader.GetRows("Erp:BO:PORelSearch"
								,"PONum=" + PONum + " and POLine=" + POLine + " and PORelNum=" + PORelNum
								, "SysRowID, ArrivedQty");
				if(ds.Tables[0].Rows.Count > 0 )
					e.Row.Cells["ArrivedQty"].Value = Convert.ToDecimal(Convert.ToDecimal(ds.Tables[0].Rows[0]["ArrivedQty"]).ToString("0.00"));
			}
			catch (Exception ex){
				MessageBox.Show(ex.Message);
			}
		}
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal

		ugdLate.InitializeRow -= new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		ugdToday.InitializeRow -= new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		ugdThisWeek.InitializeRow -= new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		//ugdFuture.InitializeRow -= new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(POList_InitializeRow);
		_boReader = null;
	}
}

1 Like

My apologies for leading you astray :joy::joy::joy:

EDIT:
I realize this can be interpreted as passive aggressive and this was not my intent. I genuinely am sorry and can relate to the struggle of wading through outdated information. Kudos to you for sticking with it and coming to a solution! :fist_right::fist_left:

Haha yeah thanks. I kept going cuz I figured learning how to use BOReader could prove useful in the future. Figuring out the roadbumps with the new column defaulting to hidden, and the new BOReader method calls, and the silent errors, took a lot of time to get through.

I’m thinking the code could be made much more efficient by using a single BOReader call using a long (really long!) where clause, ORing all the different rows together, then matching them up client side. I wonder what the limit on length for the where clause is…