Hello
I am trying to program a way of the user creating dynamic reports.
The user will be presented with a dropdown list of columnames, which may come from multiple tables and be able to select a value along with whether it is =, >,< etc..
So far I have a dropdown list with a list of column names from one entity and a textbox where the user can enter the value that the column anem should be = to (I am starting with = only)
The intention is to generate a report from a list of "where clauses" that the user has specified.
ie description from the drop down list and value ="my order"
At the moment I am just working with on entity, the orderDetail entity, with the intention to work out some way of doing it with multiple entities, but I have stumbled at the first hurdle.
I am trying to create the IEntityField2 to add to a filter to the bucket dynamically depending on which column the user selects.
The error I am getting is:
_The multi-part identifier "dbo.OrderDetail.Description" could not be bound. _
The code I am using so far is:
(the fieldName currently selected is "Description" (dataType = text) and the containingObjectName = "OrderDetailEntity")
string[] dropValues = DropDownList1.SelectedValue.Split('.');
string fieldName = dropValues[1];
string containingObjectName = dropValues[0];
IEntityField2 ent = EntityFieldFactory.Create(containingObjectName, fieldName);
IRelationPredicateBucket bucket = new RelationPredicateBucket((EntityField2)ent == valueTextBox.Text);
EntityCollection orderDetail = new EntityCollection(new OrderEntityFactory());
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchEntityCollection(orderDetail, bucket, null);
}
What am I doing wrong? Is what I am trying to do possible?
If it is, do you also have any suggestions how I would go about doing this for multiple tables and entities?
Thanks
Bex