Projecting to Dataset

Posts   
 
    
Micah
User
Posts: 11
Joined: 26-Jun-2007
# Posted on: 12-Aug-2008 20:10:32   

Hello All.

first the basics: LLBLGen Pro v2.6 VS 2005 XP Pro SP3 SQL Server 7

I am having trouble getting my head around how to do this. let me try to explain. i have a small application that allows users to select a myriad of criteria cominations to create a resultset (either a collection or datatable).

now i am working on the reporting end of the app. all the criteria and searching works perfectly. i can get a full graph in a collection.

what i need is the ability to transform the results of their query into a full hierarchical graph DataSet. The reason this is needed is that i am trying to allow them to build their own reports with a report builder (DevExpress XtraReports to be precise). The problem is that whoever created the data base named all the fields in hungarian notation so this is very cryptic for the users. i need to do this projection using aliases so i can give them field names that make sense to their meager minds.

let me give a very watered down version of what i need. There are many more tables/fields involved, but this will give the idea.

Tables: Contacts: lContactID - PK szFirstName szLastName sGender Roles: lRoleID - FK lContactID - FK RolesList: lRoleID -PK szRoleName

What i want to return to the report designer is a DataSet of these tables with aliases like this:

Tables: Contacts: Contact ID- PK First Name Last Name Gender Roles: Role ID- FK Contact ID- FK RolesList: Role ID-PK Role Name

Now bear in mind i already have all the logic in place to build the predicates and relations and prefetch paths. i just need a way to transform the results into a related DataSet.

I think this is possible using projections but for the life of me i cannot seem to wrap my mind around how this can be done.

Thanks in advance for all your help.

-Micah

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 13-Aug-2008 10:08:58   
Micah
User
Posts: 11
Joined: 26-Jun-2007
# Posted on: 13-Aug-2008 17:13:53   

Walaa wrote:

Have you checked Hierarchical projections of entity collections?

Thanks Walaa for your response.I have checked that and it doesnt clue me in as to how to do the aliasing of filed names. That is actually what makes me think this is a possible task, i just cant figure out how to do it with the field aliasing as i need.

Maybe i didnt make my problem clear enough, the main thing i need is a way to not just return the dataset but to have the aliases set as i tried to show in my first post.

does anyone know how this can be accomplished?

thanks for all the help.

-Micah

Edit:

i forgot to mention that i am using the self servicing model, in case that makes any difference.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 13-Aug-2008 19:19:41   

In general it's recommended that you re-name entities and fields in the designer to be much readable and usable, you can also set EntityNameStripPattern and EntityFieldNameStripPattern to patterns to be stripped from entity and entityField names.

Anyway, you may try not to use:

EntityFields.ConvertToProjectors()

And instead use:

new EntityPropertyProjector()

e.g.

customerProjections.Add(new EntityPropertyProjector(new EntityProperty("myEntityFieldName"), "BetterName"));

Check back the example in the docs and it will give you more clues.