Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 190929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:17:52+00:00 2026-05-11T16:17:52+00:00

A Report can have multiple charts. The Chart table looks as follows: Chart —

  • 0

A Report can have multiple charts. The Chart table looks as follows:

  • Chart — Id, ChartId, ReportId, …

The ChartId above can map to the ChartId to either one of the following Chart Types:

  • Line: ChartId, Thickness, YAxis, XAxis, Color, …
  • Pie: ChartId, Radius, Color, …
  • Bar: ChartId, Width, Color, Border, …

I am using SQL Server and unfortunately alternate solutions like using CouchDB etc are not viable options. I also intend to map these tables to entities using Entity Framework.

This design is my first stab and I see multiple problems with this design:

  1. Chart.ReportId cannot be a foreign key on multiple tables so enforcing an FK is a problem.
  2. When running an SQL (Or Linq) query, I’ll have to do either run two queries to get the chart type and then query that table. Or, I’ll have to run a join against all the tables to get the chart data.
  3. When doing a join against the Chart Types, The ChartId across these tables need to be unique so Chart.ChartId maps to only one of Line.ChartId or Bar.ChartId or Pie.ChartId.
  4. Mapping this with EF will be tricky.

I would imagine this is a common enough problem that there are prescribed solutions and established ways to handle it.

Am I on the right path with the design? And if so, how to overcome the above problems (FK, join, unique id across multiple tables, and mapping).

Solution

This answer is quite comprehensive about the strategies. And SQL Team’s article on implementing table inheritance in SQL Server got me where I wanted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:17:53+00:00Added an answer on May 11, 2026 at 4:17 pm

    Have you considered putting the Charts in the same table and using a Table per heirarchy inheritance pattern? The link there shows how to implement this in Entity Framework. Whether or not it’s viable depends on just how different all those chart types will be and how many fields each will need.

    There is also Table per type inheritance which is more similar to what you are already describing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I set a parameter of a sub-report? I have successfully hooked myself
I am attempting to have a ReportHandler service to handle report creation. Reports can
I have a feeling this is a repost but I can't seem to find
I have built a MS Access 2007 application that can create reports files in
I've just found IPython and I can report that I'm in deep love. And
How can I generate a report in access with the data from a recordset
I want to know I can dynamically modify an existing Crystal Report (using C#
I can't quite figure this out. Microsoft Access 2000, on the report total section
I'm working on a report in Reporting Services and I can't figure out why
In Crystal reports, you can define default values for the report parameters. For example,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.