Binding Related Entity

Posts   
 
    
Posts: 18
Joined: 14-Apr-2005
# Posted on: 07-Jun-2005 17:46:10   

Hello. I am using the adapter scenerio. 1.0.2004.2.

I have 3 tables that are related as you would expect. Company Region CompanyRegion

I am doing a fetch on "CompanyRegion" (I need some info from the cross table) and prefetching "Company" to get the name of the company.

I am binding my collection of "CompanyRegion"s to a Janus grid and want to have a column that maps to "Company.CompanyName"

my grid has 3 columns "Company Name" -> Company.CompanyName "IsSponsor" -> CompanyRegion.IsSponsor "IsFeatured" -> CompanyRegion.IsFeatured

How do I get the CompanyName column to show up? the data is being return properly through my prefetch, but the binding to the related "Company" Entity is not working.

Is this possible? thank you Jason

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 07-Jun-2005 20:23:44   

slackboy13013 wrote:

Hello. I am using the adapter scenerio. 1.0.2004.2.

I have 3 tables that are related as you would expect. Company Region CompanyRegion

I am doing a fetch on "CompanyRegion" (I need some info from the cross table) and prefetching "Company" to get the name of the company.

I am binding my collection of "CompanyRegion"s to a Janus grid and want to have a column that maps to "Company.CompanyName"

my grid has 3 columns "Company Name" -> Company.CompanyName "IsSponsor" -> CompanyRegion.IsSponsor "IsFeatured" -> CompanyRegion.IsFeatured

How do I get the CompanyName column to show up? the data is being return properly through my prefetch, but the binding to the related "Company" Entity is not working.

Is this possible? thank you Jason

I'm not familiar with the Janus grid but you might want to make sure that your grid supports traversing the relationships to the Company entity.

The other alternative is to use the Designer's support for mapping fields on 1:1 related entities' fields. This would allow you to add "Company.CompanyName" as a field in "CompanyRegion". Not the best solution in this particular case, but it would work.

Jeff...

Posts: 18
Joined: 14-Apr-2005
# Posted on: 07-Jun-2005 20:26:27   

hmm... that seems like a good idea. I really don't use the crosstable entities for anything else but this specific form. I have never done this. I can do it through the designer? I will poke around.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 07-Jun-2005 20:34:25   

slackboy13013 wrote:

hmm... that seems like a good idea. I really don't use the crosstable entities for anything else but this specific form. I have never done this. I can do it through the designer? I will poke around.

What you want to do isn't possible, that direct binding in a grid. What you should do is set the DataMember to "Company" and simply set the column to bind to 'CompanyName'.

As Jeff says, you can also map fields on related entity fields, which is perhaps a better idea. simple_smile fields mapped on related fields also work for m:1 relations.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 18
Joined: 14-Apr-2005
# Posted on: 07-Jun-2005 20:52:15   

Otis wrote:

slackboy13013 wrote:

hmm... that seems like a good idea. I really don't use the crosstable entities for anything else but this specific form. I have never done this. I can do it through the designer? I will poke around.

What you want to do isn't possible, that direct binding in a grid. What you should do is set the DataMember to "Company" and simply set the column to bind to 'CompanyName'.

As Jeff says, you can also map fields on related entity fields, which is perhaps a better idea. simple_smile fields mapped on related fields also work for m:1 relations.

Thanks for the reply frans. I need data from the cross table "CompanyRegion", so I can't just bind to "Company". The important data on this form is the flags from the crosstable, the companyname just being a prettier identifier then an "Id". I wil try the field mapping.

Posts: 18
Joined: 14-Apr-2005
# Posted on: 07-Jun-2005 20:55:30   

I just tried to create this mapped field, and the designer is generating an exception, when i checked the readonly box. something about a checkbox. maybe i need the new version.

if you need more info, i will upload a screenshot of the error.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 07-Jun-2005 21:07:36   

slackboy13013 wrote:

I just tried to create this mapped field, and the designer is generating an exception, when i checked the readonly box. something about a checkbox. maybe i need the new version.

if you need more info, i will upload a screenshot of the error.

Yes that bug was fixed some time ago, please update the designer. Sorry for this inconvenience.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 18
Joined: 14-Apr-2005
# Posted on: 07-Jun-2005 21:54:39   

hey no need for appologies. your product is maybe the best development tool I have ever used. (OK, the first time i ever used visual basic 3, i was floored, but who can remember those ancient days! hehe.)

PS - the mapped field worked perfectly.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Jun-2005 11:44:47   

slackboy13013 wrote:

hey no need for appologies. your product is maybe the best development tool I have ever used. (OK, the first time i ever used visual basic 3, i was floored, but who can remember those ancient days! hehe.)

smile

PS - the mapped field worked perfectly.

Glad it's solved! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
TogasPoon
User
Posts: 42
Joined: 09-Feb-2006
# Posted on: 22-Feb-2006 16:20:36   

Is it possible to go two tables deep?

Following the example above. Say you wanted to also display a field that is in the company entity's fields on related entity fields.

So in the company entity you add CFO to it's related fields tab.

Can you then access the CFO field from CompanyRegion entity in a similar way?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 23-Feb-2006 03:34:24   

I don't believe that you can add a related field from another entity.