Walaa wrote:
It must return Zero records.
There can be no row in the database which has the description field starts with "Bei" and at the same time it starts with "Chi".
Hi Walaa. You are the right man. DB has got matching records. But output it shows zero records.
My Complete code is reproduced below
******** Declarations****************
readonly DataAccessAdapter adapterstate = new DataAccessAdapter();
readonly EntityCollection<StateEntity> datasourcestate = new EntityCollection<StateEntity>(new StateEntityFactory());
readonly RelationPredicateBucket bucketcountry = new RelationPredicateBucket();
private readonly DataAccessAdapter adaptercountry = new DataAccessAdapter();
private readonly EntityCollection datasourcecountry = new EntityCollection(new CountryEntityFactory());
readonly IPrefetchPath2 prefetchPathstate = new PrefetchPath2((int)EntityType.StateEntity);
IEntityView2 stateView;
static readonly IPredicateExpression filterstate = new PredicateExpression();
private readonly RelationPredicateBucket relationcountry = new RelationPredicateBucket();
******** Declarations****************
******** Load Grid****************
prefetchPathstate.Add(StateEntity.PrefetchPathCountry);
filterstate.Add(StateFields.Flag == StandardFlag.recordvalidflag);
adapterstate.FetchEntityCollection(datasourcestate, null, prefetchPathstate);
stateView = datasourcestate.DefaultView;
stateView.Filter = filterstate;
dgridstate.DataSource = stateView;
******** Load Grid****************
******** Filter****************
filterstate.Clear();
filterstate.Add(new FieldLikePredicate(StateFields.Description, null,
"Bei%"));
relationcountry.Relations.Add(CountryEntity.Relations.StateEntityUsingCountryId);
filterstate.AddWithAnd(new FieldLikePredicate(CountryFields.Description, null,
"Chi%"));
stateView.Filter = filterstate;
******** Filter****************