Search code examples
epicorerp

Epicor9 - How to filter columns display in UDAdapter search window


I have created following SearchOnUDAdapterShowDialog() function using customization wizard, which allow users to search UD table content. The issue is that search results display all columns in UD table. I need to display only few relevant columns, and change default column names to a user friendly names.

private void SearchOnUD100AdapterShowDialog()
{
    // Wizard Generated Search Method
    // You will need to call this method from another method in custom code
    // For example, [Form]_Load or [Button]_Click

    bool recSelected;
    string whereClause = string.Empty;
    System.Data.DataSet dsUD100Adapter = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "UD100Adapter", out recSelected, true, whereClause);
    if (recSelected)
    {
        System.Data.DataRow adapterRow = dsUD100Adapter.Tables[0].Rows[0];

        // Map Search Fields to Application Fields
        EpiDataView edvVendorDetail = ((EpiDataView)(this.oTrans.EpiDataViews["VendorDetail"]));
        System.Data.DataRow edvVendorDetailRow = edvVendorDetail.CurrentDataRow;
        if ((edvVendorDetailRow != null))
        {
            edvVendorDetailRow.BeginEdit();
            edvVendorDetailRow["ShortChar09"] = adapterRow["Key1"];
            edvVendorDetailRow.EndEdit();
        }
    }
}

Appreciate your help. Thanks.


Solution

  • Try calling this just before the call to listLookup:

    EpiSearchBase adapterSearchForm = ((Epicor.Mfg.UI.Adapters.UD100Adapter)oTrans_adapter).SearchForm;     
    adapterSearchForm.ClearEpiSearchColumns();
    
    // Paramters: Data Column Name, Column Header Text, Width, Is Result, Position
    adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("Key1", "Alteration Fee Type", -1, true, 0), true);        
    adapterSearchForm.SetEpiSearchColumn(new EpiSearchColumn("Character01", "Description", -1, false, 1), true);