Question

Add Filter to a Search Button

  • 10 June 2022
  • 4 replies
  • 464 views

Hi,

 

I have created a button on the POHeader to pull in a user who is to receive the Purchased items when they are delivered.

 

I have the button working fine on its own with no filters but when I try to add a filter to pull active users only I receive an error, I have tried various iterarations with various errors but to no avail.

 

I have changed to following:

FROM:

 string whereClause = string.Empty;

TO:

 string whereClause = string.Format("EmpBasic.EmpStatus = '{A}'");

 

Code below:

private void btnContact_Click(object sender, System.EventArgs args)
    {
        // ** Place Event Handling Code Here **
        SearchOnEmpBasicAdapterShowDialog();
    }

    private void SearchOnEmpBasicAdapterShowDialog()
    {
        // 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.Format("EmpBasic.EmpStatus = '{A}'");
        System.Data.DataSet dsEmpBasicAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "EmpBasicAdapter", out recSelected, true, whereClause);
        if (recSelected)
        {
            System.Data.DataRow adapterRow = dsEmpBasicAdapter.Tables[0].Rows[0];

            // Map Search Fields to Application Fields
            EpiDataView edvPOHeader = ((EpiDataView)(this.oTrans.EpiDataViews["POHeader"]));
            System.Data.DataRow edvPOHeaderRow = edvPOHeader.CurrentDataRow;
            if ((edvPOHeaderRow != null))
            {
                edvPOHeaderRow.BeginEdit();
                edvPOHeaderRow["ShipToConName"] = adapterRow["Name"];
                edvPOHeaderRow.EndEdit();
            }
        }
    }
}


4 replies

Userlevel 1

Hi Steve,

 

I have done similar things using combo boxes and the standard filtering options within those if I remember correctly. 

What version are you running? Classic, Shell or Kinetic?

Hi Gary,

 

We are running 10.2.700 classic

 

Thanks

Steve

 

Userlevel 1

Hi Steve, 

I know this isn’t a button and search but if I have understood correctly you just want to flag a user against the PO you expect to receive it. Using a dropdown box like the example below makes this pretty easy to do.

Hope this is what you are after.

Anyone flagged as inactive doesn’t show in the list. 

Let me know how you get on.

Hi Gary,

 

Thank you, This was my initial thought by pulling in the EmpBasic.Name field. However, we want to use the original field due to the other places it is used and SSRS - Hence the button search.

 

I do not think the code is far off but I am very new to C#.

 

Steve

Reply