Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Report Model; problem regarding many-to-many relations

Unanswered Report Model; problem regarding many-to-many relations

  • Monday, March 15, 2010 9:10 AM
     
     
    I'm having trouble setting up a report model to create reports with report builder. I guess I'm doing something wrong when configuring the report model, but it might also due to change of primary entity in report builder.

    I have 3 tables: Client, Address and Product. The Client has PK ClientNumber. The Address and Product both have a FK relation on ClientNumber. The relation between Client and Address is 1-to-many and also between Client and Product: 
    Product-(many:1)-Client-(1:many)-Address.

    I've created a report model (mostly auto generate) with these 3 tables, for each table I've made an Entity.
    Now on the Client Entity , I've got 2 roles, Address and Product. They both have a cardinality of 'OptionalMany', because Client can have multiple Addresses or Products. On both Address and Product I have a Client Role with cardinality 'One', because for each Address or Product, there has to be a Client (tried OptionalOne as well...).

    Now I'm trying to create a report in Report Builder (2.0) where I select fields from these three entities. I'd like an overview of Clients with their main address and their products, but I don't seem to be able to create a report with fields from both Address and Products in it. I start by selecting attributes from Client, and as soon as I add Product for example the Primary entity changes as if I'm selecting Products (instead of Clients).

    This is a basic example of a problem I'm facing in a much more complex model. I've tried lots of different things for 2 days, but I can't get it to work. Does anyone have an idea how to cope with this?

    (Using SSRS 2008)

    Edit: In T-SQL this is what I mean:
    SELECT
    *
    FROM
    CLIENT
    INNER JOIN ADDRESS ON CLIENT.CLIENT_NUMBER = ADDRESS.CLIENT_NUMBER AND ADDRESS.TYPE = 1
    --Main Address
    INNER JOIN PRODUCT ON CLIENT.CLIENT_NUMBER = PRODUCT.
    CLIENT_NUMBER
    WHERE CLIENT.CLIENT_NUMBER = 1

All Replies

  • Monday, May 07, 2012 1:00 AM
     
     

    I’m not sure if you solved this issue but I just joined this site and noticed that no one answered it. In looking at the first inner join in the SQL above, the join is on ADDRESS.CLIENT_NUMBER AND ADDRESS.TYPE = 1.  I do not believe that ADDRESS.TYPE = 1 should be a join parameter.