I was wondering if you could tell me whether it's possible to generate dynamic views in DEWD? I've got a bunch of entities that have a category checkbox list field on them, with the checkbox options coming from another table managed via DEWD. What I want then, is in the view for the main entity be able to select from the "Select view" any one of those categories and have the results filter by it. The columns / query for the view would always be the same, it's just the where clause parameter that changes and it needs to be dynamic from the database.
I think this should be possible in both versions, but in 1.0 I suspect a custom repository is needed. In 2.0 you should be able to do something like this:
var dynamicViews = new TableRepository();
dynamicViews.SetViewBuilder(() =>
{
var views = new List<IView>();
for(var foo = 0;foo<3; foo++)
views.Add(new TableView(dynamicViews) { Sql = (new SqlStatement("SELECT * FROM table")).AddParameter("param", t) });
return views;
});
So basically provide the SetViewBuilder with a delegate that instantiates the views with the different WHERE-statements. In your case some SQL will be needed to get the different categories of course.
Creating dynamic views?
Hi Guys,
I was wondering if you could tell me whether it's possible to generate dynamic views in DEWD? I've got a bunch of entities that have a category checkbox list field on them, with the checkbox options coming from another table managed via DEWD. What I want then, is in the view for the main entity be able to select from the "Select view" any one of those categories and have the results filter by it. The columns / query for the view would always be the same, it's just the where clause parameter that changes and it needs to be dynamic from the database.
Any ideas?
Cheers
Matt
Hi Matt,
I think this should be possible in both versions, but in 1.0 I suspect a custom repository is needed. In 2.0 you should be able to do something like this:
So basically provide the SetViewBuilder with a delegate that instantiates the views with the different WHERE-statements. In your case some SQL will be needed to get the different categories of course.
Hope this makes sense.
is working on a reply...