I have a UDF that returns a comma-delimited string of values that I use to indicate a one-to many relationship in my resultset without returning multiple rows that would be duplicates other than the foreign key.
For example, instead of this:
TaskName........AssignedTo
Task A..............Joe
Task B..............Joe
Task A..............Mary
I want to end up with this:
TaskName........AssignedTo
Task A..............Joe, Mary
Task B..............Joe
SQL-wise, I can accomplish this by doing a normal select and using the following UDF for the AssignedTo column:
dbo.ConcatTaskMembers(dbo.Tasks.TaskID) AS AssignedTo
This works great in query analyzer, but I cannot find any information on whether or not this is supported in the LLBL designer and how I would implement it. It doesn't seem like you can map a non-entity value to a typed list column. I briefly looked at custom properties but that did not seem to be what I want.
By the way, I can get the UDF part to work in LLBL using a view, but the problem I'm having there is that since the relationships are merged in the view, I get all tasks related to multiple members as duplicates. I have to be able to filter on MemberID, and since it's in the view it always makes the otherwise duplicate rows distinct. In the example above, I would always get all 3 rows returned like so:
TaskName........AssignedTo......MemberID
Task A..............Joe, Mary.........1
Task B..............Joe..................1
Task A..............Joe, Mary.........2
In LLBL there does not seem to be a way to filter on a typed view column but NOT return that column as part of the result fields. Or maybe I'm missing something. It seems like you have to do this:
IEntityFields2 fields = tasks.GetFieldsInfo();
when what I really want is to either specify my own fields or do something like this:
IEntityFields2 fields = tasks.GetFieldsInfo();
fields.Remove(FieldIndex.MemberID);
I looked at the dynamic list field syntax but could not get that to work with my typed view. Basically, I don't care HOW to get this done -- I just want to end up with my list with the members delimited and not duplicated as specified in the examples above.
Any ideas?