I am trying to filter the results in an EpiCombo that I have placed on the Project Memo. I want to retrieve the Character01 value from table UD20 where the ProjectID (Key1 in the UD20 table) = Key1 in the Memo table (ProjectID). At present, I am getting all the Character01 values and my filter is not working. I think it is an error in the syntax but I may also have missed something else.
Hi Aaron,
Thanks for this. When I hard code the ProjectID as below, it works. It’s when I use Key1, which is the ProjectID in both the UD20 and the Memo table, it does not work, it just returns all the character01 values in the table.
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.
I’ve tried just about every combination I can think of now.
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
I’ll see if I can recreate your scenario on Monday; I’ll let you know what I find out.
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);
}
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.
Hi Aaron,
Do I leave this in there or remove it?
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;
Inserted your code in the script editor, but it still returns all the customers from UD20
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?
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);
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
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