Adding a Column to the Supplier Price List Part Search

Our purchasing team ask me if I can modify the search result in the Supplier Price List Program when the user searching for Part after selecting the Supplier. All they want to see is the description of the Part in the search result. I tried doing a Quick Search, but the search isn’t so easy to do as the Part button is enabled after the supplier has been selected. What is the simplest way to achieve this?

I followed the code example in this topic

private void oTrans_adapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
	{
		// ** Argument Properties and Uses **
		// ** args.MethodName **
		// ** Add Event Handler Code **

		// ** Use MessageBox to find adapter method name
		// EpiMessageBox.Show(args.MethodName)
		switch (args.MethodName)
		{
			case "GetList":
			case "GetRows":
				EpiSearchBase adapterSearchForm = oTrans_adapter.SearchForm;

				if (adapterSearchForm != null)
            	{
    	            adapterSearchForm.ClearEpiSearchColumns();
 
        	        // Parameters: Data Column Name, Column Header Text, Width, Is Result, Position
            	    adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("PartNum", "Part Num", -1, true, 0), true);
					adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("PartDescription", "Description", -1, true, 1), true);
    	            adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("EffectiveDate", "Effective Date", -1, true, 2), true);
         	       adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("PUM", "UOM", -1, true, 3), true);
            	}
				break;
		}
	}

This code does work, however, I cannot explain why there is an additional column called Operation that concatenated into the 5th column… Any ideas?

I would need to see the exact code.

Here is the code that I created on the Supplier Price List Entry Form. This does work and add the Description in the column when I open part search

// Custom code for SupplierPriceListEntryForm
// Created: 9/06/2020 5:41:52 PM
// **************************************************

extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_Vendor;

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;

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

	private EpiBaseAdapter oTrans_adapter;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		this.oTrans_adapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT["oTrans_adapter"]));
		this.oTrans_adapter.BeforeAdapterMethod += new BeforeAdapterMethod(this.oTrans_adapter_BeforeAdapterMethod);
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
	}

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

		this.oTrans_adapter.BeforeAdapterMethod -= new BeforeAdapterMethod(this.oTrans_adapter_BeforeAdapterMethod);
		this.oTrans_adapter = null;
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void oTrans_adapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
	{
		// ** Argument Properties and Uses **
		// ** args.MethodName **
		// ** Add Event Handler Code **

		// ** Use MessageBox to find adapter method name
		// EpiMessageBox.Show(args.MethodName)
		switch (args.MethodName)
		{
			case "GetList":
			case "GetRows":
				EpiSearchBase adapterSearchForm = oTrans_adapter.SearchForm;

				if (adapterSearchForm != null)
            	{
    	            adapterSearchForm.ClearEpiSearchColumns();
 
        	        // Parameters: Data Column Name, Column Header Text, Width, Is Result, Position
            	    adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("PartNum", "Part Num", -1, true, 0), true);
					adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("PartDescription", "Description", -1, true, 1), true);
    	            adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("EffectiveDate", "Effective Date", -1, true, 2), true);
         	       adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("PUM", "UOM", -1, true, 3), true);
            	}
				break;
		}
	}
}

I tried quick search it worked for me.
created BAQ using “Erp.VendPart” table, selected “partnum” and “description”
Created quick search in the supplier price list and suppressed the base search.

So everything is working now?

It does work, but there is the extra Operation Column in the result, that is the part I don’t understand.

How do you pass the VendorNum into the Quick Search?

I cross checked, it is bringing all the parts which are in the supplier price list without supplier filter.
But my question is, if filter by the supplier, if the user wants add a new part, where will they get the new part from ?

In The Supplier Price List Maintenance, when you add new part, the new part will have the associated VendorNum into the VendorPart Table. The structure of that particular screen is quite hard to customize, but for now, I just leave it as is with the OperationText Column as it doesn’t hurt to have it.

1 Like