Filtering an EpiCombo

It’s hard to tell from your original screenshot if your syntax contains a period or a comma (it looks like a period).

Try some variations:

Key1 = '?[Key1,'']'
Key1 = '?[Memo.Key1,'']'

Place them in the EpiFIltersAppend and see if that works.

You could also try method #2 here.

That’s the one I’m more familiar with, but had the syntax snippet on my other computer.

1 Like

I’ve tried just about every combination I can think of now. :frowning:

The first customer displays correctly but when I click the dropdown to select from the list, every customer in the table is there, I just want the ones from UD20 where Key1 matches Key1 in the memo table
image

I’ll see if I can recreate your scenario on Monday; I’ll let you know what I find out.

1 Like

Well, I tried fiddling with the properties and got the same results as you.
Went into the script and got it to work with this:

	private void epiComboC1_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
	{
		// ** Place Event Handling Code Here **
		EpiDataView edv = oTrans.Factory("Memo");
		string custNumStr = edv.dataView[edv.Row]["Key1"].ToString();

		this.epiComboC1.Rows.ColumnFilters["Key1"].FilterConditions.Clear();
		this.epiComboC1.Rows.ColumnFilters["Key1"].FilterConditions.Add(Infragistics.Win.UltraWinGrid.FilterComparisionOperator.Equals,custNumStr);
	}
1 Like

Thanks for taking the time to help me with this. I will implement your example and let you know how I get on. Thanks again.

1 Like

Hi Aaron,
Do I leave this in there or remove it?

image

Leave all of the setup for that, but remove any filters you have on that screen.

I must be doing something wrong. I have cleared everything from the filters;
image
Inserted your code in the script editor, but it still returns all the customers from UD20 :thinking:

Looks like you’re only pulling back Chacter01.
Either remove that (since you have a DescColumnName and Value Member already set), or add Key1 to the EpiHiddenColumnsAppend.

It would not let me delete Character01 from the DisplayMember, it just automatically put it back again. I added Key1 to the EpiHiddenColumnsAppend but still getting all the customers from UD20 back.
I’m thinking that maybe Key1 (The ProjectID) where the memo is being entered, is not being set. It should be looking in UD20 to return all the Character01s where Key1 (The ProjectID in UD20) = Key1 the ProjectID in the memo. If that makes sense

Well, during my testing, I wondered the same thing and ended up creating a button to show me what Memo.Key1 was.

And you’re sure that UD20.Key1 is, in fact, a project ID?

1 Like

Yes, here is an example using ProjectID 200004;
image
and UD20 looks like this;

Try creating a button to compare the results of UD20.Key1 and Memo.Key1 to make sure they’re actually the same.
If they’re not, you may have to massage the data with .Trim() to remove whitespace or something else.

Just as another note–did you create that drop down method using the event wizard or did you copy+pasta mine and change the name?
If the latter, you’ll want to add this in the initialize:

this.epiComboC1.BeforeDropDown += new System.ComponentModel.CancelEventHandler(this.epiComboC1_BeforeDropDown);

And this in the destroy:

this.epiComboC1.BeforeDropDown -= new System.ComponentModel.CancelEventHandler(this.epiComboC1_BeforeDropDown);
1 Like

You are a star Aaron, I added the initialize and destroy code and hey presto! it worked!
Thanks for spending so much time on this with me. I owe you a nice drink some time :slight_smile: :beer: :beer: :beer:

2 Likes

Glad to hear it!

Sorry I’m late to the party the syntax for filtering from an existing dataview is annoying here it is for posterity.

EpiFilters= Character01 = '?{Key1ColName}'
EpiFiltersParams =Key1ColName=?[Character01]

So EpiFilters you pass in the name of a paramter and in EpiFiltersParams property you set the Parameter up to pull from the data view.

The reason why this didn’t work for you
Is because you mispelled the parameter name in your example
image

3 Likes

More Examples for the sake of the thread.

image
image

You can also use SQL Functions, Ice SQL Functions.

Behind The Scenes

SearchFilter + EpiFilters + EpiFiltersAppend are just combined and executed against SQL (they are not post-filters).

Also just for the record, if your SearchFilter starts with CodeTypeID Epicor will set the DropDownStyle Automatically to DropDownList. So you dont have to set it in Code anymore.

5 Likes

Hi guys, @hmwillett , @hkeric.wci @josecgomez
Just a quick question. Everything is working great except for one small problem. When we save the Project Customer as the one we select from the dropdown list, it reverts back to the entry at the top of the list the next time we open the memo. I have bound the control to the ProjectCustomer field in MemoUD table, but it seems the list generation for the combobox is overwriting the content every time. Is there a way to display the value that was saved, it is after all in the list, just not always at the top. I have experimented a bit with the properties but had no luck as yet.

I figured it out eventually. I needed Character01 in the ValueMember, not Key1. As Key1 is the Project Number it obviously did not exist in the Project Customer list. Seems fine now.

1 Like