?
Solved

Linq query getting % of questions in test

Posted on 2016-08-23
9
Medium Priority
?
73 Views
Last Modified: 2016-08-30
I would like to get the percentage of a "type" of questions within an exam.  I am able to get the total number each  "type" of question and I am able to get the total number of questions in an exam. I would like some help getting the percent of each "type" of questions within the exam.  

Controller:
ExamBreakdownViewModel vm = new ExamBreakdownViewModel();

			IQueryable<ExamBreakdownViewModel> Concern1 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 1 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern1 = Concern1.ToList();

			IQueryable<ExamBreakdownViewModel> Concern2 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 4 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern2 = Concern2.ToList();

Open in new window



Controller Doesn't work:
IQueryable<ExamBreakdownViewModel> Percent1 = from e in db.exams
													 join eq in db.exams_questions on e.exams_id equals eq.exams_id
													 where (eq.concerns_id == 1 && e.exams_id == id)
													 group e by e.credentials_id into OrderGroup
													 select new ExamBreakdownViewModel()
													 {
														 credentials_id = OrderGroup.Key,
														 ConcernCount = OrderGroup.Average()
														
													 };
			vm.Percent1 = Percent1.ToList();

Open in new window




Model:
public List<ExamBreakdownViewModel> Concern1 { get; set; }
		public List<ExamBreakdownViewModel> Concern2 { get; set; }	
		public List<ExamBreakdownViewModel> Sum { get; set; }
		public List<ExamBreakdownViewModel> Percent1 { get; set; }
		public List<ExamBreakdownViewModel> Percent2 { get; set; }
		

		public int ConcernCount { get; set; }
		public int PercentCount { get; set; }

Open in new window


View:  
<table>
                    <tr>
                        <th class="col-md-3">Concern</th>
                        <th class="col-md-3">Number of Questions</th>
                        <th class="col-md-3">Percentage of Exam</th>
                    </tr>
                    <tr>
                        <td>
                            Law and Ethics
                        </td>
                        <td>
                            @foreach (var ExamBreakdownViewModel in Model.Concern1)
                            {                                                      
                                    {@ExamBreakdownViewModel.ConcernCount}         
                            }
                        </td>
                        <td>  **What would go here**                            
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Insurance
                        </td>
                        <td>
                            @foreach (var ExamBreakdownViewModel in Model.Concern5)
                            {
                                if (ExamBreakdownViewModel.ConcernCount > 1)
                                {  
                                    {@ExamBreakdownViewModel.ConcernCount}
                                }
                            }
                        </td>
                        <td>     **What would go here**                        
                        </td>
                    </tr>
                </table>

Open in new window


Capture.PNG

Thanks for your help.
0
Comment
Question by:lovettjay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41767663
Hi lovettjay;

The following code snippet will calculate the percentage for each
int TotalConcern1Questions = 25;
int TotalConcern2Questions = 27;
int TotalQuestions = TotalConcern1Questions + TotalConcern2Questions;

double Percent1 = Percentage(TotalQuestions, TotalConcern1Questions);
double Percent2 = Percentage(TotalQuestions, TotalConcern2Questions);

public double Percentage( int totalQuestions, int totalQuestionsInConcern)
{                                                                         
	return (double)(100 * totalQuestionsInConcern) / totalQuestions;        
}

Open in new window

0
 

Author Comment

by:lovettjay
ID: 41769017
Thanks for your reply.  

I am truly a beginner.  This site and the help I have received from people like you have been a blessing.  However can you go into a little more detail?  I have been trying to get this to work since your reply yesterday afternoon and I'm not having any luck.  

In MVC would this go in the controller under the action?  If so in your code line 6 says it's missing a }.  I also tried putting this into the view under razor syntax and still have had some problems.  


Thanks again,

Jay
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41769026
The code should go into the Controller. Can you post your Controller code and any model class that it is using and we can go from there.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lovettjay
ID: 41769048
Model:
               public List<ExamBreakdownViewModel> Concern1 { get; set; }
		public List<ExamBreakdownViewModel> Concern2 { get; set; }
		public List<ExamBreakdownViewModel> Sum { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern1Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern2Questions { get; set; }

		public int ConcernCount { get; set; }
		public int PercentCount { get; set; }

Open in new window


I have Concerns and TotalConcernsQuestions both going to 75.

Controller:
	public ActionResult ExamBreakDown(int? id)
		{
			if (id == null)
			{
				return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
			}
			exam exam = db.exams.Find(id);
			if (exam == null)
			{
				return HttpNotFound();
			}

ExamBreakdownViewModel vm = new ExamBreakdownViewModel();

IQueryable<ExamBreakdownViewModel> Concern1 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 1 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern1 = Concern1.ToList();

			IQueryable<ExamBreakdownViewModel> Concern2 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 2 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern2 = Concern2.ToList();



IQueryable<ExamBreakdownViewModel> Sum = from e in db.exams
													 join eq in db.exams_questions on e.exams_id equals eq.exams_id
													 where (e.exams_id == id)
													 group e by e.credentials_id into OrderGroup
													 select new ExamBreakdownViewModel()
													 {
														   credentials_id = OrderGroup.Key,
														 ConcernCount = OrderGroup.Count()
													 };
			vm.Sum = Sum.ToList();


		
			return View(vm);
		}

Open in new window



Thanks,

Jay
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 41769172
Hi Jay;

Please post the complete class for ExamBreakdownViewModel. Also in what you marked as model it only has one item marked as Percent where you need one for each Concern. Please place some comments in the code that has to do with what you are trying to achieve so I can figure out what you are doing.
0
 

Author Comment

by:lovettjay
ID: 41769390
Hello,

Model:

public partial class ExamBreakdownViewModel
	{
		//list of all the different type of questions
		public List<ExamBreakdownViewModel> Concern1 { get; set; }
		public List<ExamBreakdownViewModel> Concern4 { get; set; }
		public List<ExamBreakdownViewModel> Concern5 { get; set; }
		public List<ExamBreakdownViewModel> Concern8 { get; set; }
		public List<ExamBreakdownViewModel> Concern9 { get; set; }
		public List<ExamBreakdownViewModel> Concern10 { get; set; }
		public List<ExamBreakdownViewModel> Concern13 { get; set; }
		public List<ExamBreakdownViewModel> Concern14 { get; set; }
		public List<ExamBreakdownViewModel> Concern15 { get; set; }
		public List<ExamBreakdownViewModel> Concern16 { get; set; }
		public List<ExamBreakdownViewModel> Concern17 { get; set; }
		public List<ExamBreakdownViewModel> Concern18 { get; set; }
		public List<ExamBreakdownViewModel> Concern19 { get; set; }
		public List<ExamBreakdownViewModel> Concern20 { get; set; }
		public List<ExamBreakdownViewModel> Concern21 { get; set; }
		public List<ExamBreakdownViewModel> Concern22 { get; set; }
		public List<ExamBreakdownViewModel> Concern23 { get; set; }
		public List<ExamBreakdownViewModel> Concern24 { get; set; }
		public List<ExamBreakdownViewModel> Concern25 { get; set; }
		public List<ExamBreakdownViewModel> Concern26 { get; set; }
		public List<ExamBreakdownViewModel> Concern27 { get; set; }
		public List<ExamBreakdownViewModel> Concern28 { get; set; }
		public List<ExamBreakdownViewModel> Concern29 { get; set; }
		public List<ExamBreakdownViewModel> Concern30 { get; set; }
		public List<ExamBreakdownViewModel> Concern31 { get; set; }
		public List<ExamBreakdownViewModel> Concern32 { get; set; }
		public List<ExamBreakdownViewModel> Concern33 { get; set; }
		public List<ExamBreakdownViewModel> Concern43 { get; set; }
		public List<ExamBreakdownViewModel> Concern44 { get; set; }
		public List<ExamBreakdownViewModel> Concern45 { get; set; }
		public List<ExamBreakdownViewModel> Concern46 { get; set; }
		public List<ExamBreakdownViewModel> Concern47 { get; set; }
		public List<ExamBreakdownViewModel> Concern48 { get; set; }
		public List<ExamBreakdownViewModel> Concern49 { get; set; }
		public List<ExamBreakdownViewModel> Concern50 { get; set; }
		public List<ExamBreakdownViewModel> Concern51 { get; set; }
		public List<ExamBreakdownViewModel> Concern52 { get; set; }
		public List<ExamBreakdownViewModel> Concern53 { get; set; }
		public List<ExamBreakdownViewModel> Concern55 { get; set; }
		public List<ExamBreakdownViewModel> Concern56 { get; set; }
		public List<ExamBreakdownViewModel> Concern57 { get; set; }
		public List<ExamBreakdownViewModel> Concern58 { get; set; }
		public List<ExamBreakdownViewModel> Concern59 { get; set; }
		public List<ExamBreakdownViewModel> Concern60 { get; set; }
		public List<ExamBreakdownViewModel> Concern62 { get; set; }
		public List<ExamBreakdownViewModel> Concern64 { get; set; }
		public List<ExamBreakdownViewModel> Concern65 { get; set; }
		public List<ExamBreakdownViewModel> Concern66 { get; set; }
		public List<ExamBreakdownViewModel> Concern67 { get; set; }
		public List<ExamBreakdownViewModel> Concern68 { get; set; }
		public List<ExamBreakdownViewModel> Concern69 { get; set; }
		public List<ExamBreakdownViewModel> Concern70 { get; set; }
		public List<ExamBreakdownViewModel> Concern71 { get; set; }
		public List<ExamBreakdownViewModel> Concern72 { get; set; }
		public List<ExamBreakdownViewModel> Concern73 { get; set; }
		public List<ExamBreakdownViewModel> Concern74 { get; set; }

		//sum of all the concerns for that exam ID
		public List<ExamBreakdownViewModel> Sum { get; set; }

		//Hoping to get the Concern divided by the Sum
		public List<ExamBreakdownViewModel> TotalConcern1Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern4Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern5Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern8Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern9Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern10Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern13Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern14Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern15Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern16Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern17Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern18Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern19Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern20Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern21Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern22Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern23Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern24Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern25Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern26Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern27Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern28Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern29Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern30Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern31Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern32Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern33Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern43Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern44Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern45Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern46Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern47Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern48Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern49Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern50Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern51Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern52Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern53Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern55Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern56Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern57Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern58Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern59Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern60Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern62Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern64Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern65Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern66Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern67Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern68Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern69Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern70Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern71Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern72Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern73Questions { get; set; }
		public List<ExamBreakdownViewModel> TotalConcern74Questions { get; set; }

		//added to be able to count the number of Concerns and the Percent 
		public int ConcernCount { get; set; }
		public int PercentCount { get; set; }
	
		//from the database table of exams
        public int exams_id { get; set; }
        public Nullable<int> credentials_id { get; set; }
        public Nullable<int> credentials_status_id { get; set; }
        public string exams_description { get; set; }
        public short exams_examtime { get; set; }
        public Nullable<System.DateTime> exams_lastchange { get; set; }

		//from the database tables of exams_questions
		public int exams_questions_id { get; set; }
		public Nullable<int> questions_id { get; set; }		
		public Nullable<int> concerns_id { get; set; }
		public Nullable<short> exams_questions_order { get; set; }
		public string exams_questions_string { get; set; }
		public string exams_questions_value { get; set; }

		//from the database table of concerns		
		public string concerns_description { get; set; }

		

	}

Open in new window




Controller:
IQueryable<ExamBreakdownViewModel> Concern1 = from e in db.exams
 join eq in db.exams_questions on e.exams_id equals eq.exams_id
 where (eq.concerns_id == 1 && e.exams_id == id)
//get by id and concern_id of 1
group eq by eq.concern.concerns_description into OrderGroup
//put in group from db table concerns, field concerns_description 
 select new ExamBreakdownViewModel()
{
  concerns_description = OrderGroup.Key,
 //return collection of on concerns_description
 ConcernCount = OrderGroup.Count()
 //Count how many of each concerns_description there are
 };
vm.Concern1 = Concern1.ToList();

IQueryable<ExamBreakdownViewModel> Sum = from e in db.exams
 join eq in db.exams_questions on e.exams_id equals eq.exams_id
 //joining two tables to get exams_id
where (e.exams_id == id)
//passing through ID of clicked exam
group e by e.credentials_id into OrderGroup
 select new ExamBreakdownViewModel()
 {
credentials_id = OrderGroup.Key,
ConcernCount = OrderGroup.Count()
//ConcernCount from Model, Count total number of concerns of that test 
 };
vm.Sum = Sum.ToList();


IQueryable<ExamBreakdownViewModel> TotalConcern1Questions = from e in db.exams
 join eq in db.exams_questions on e.exams_id equals eq.exams_id
where (eq.concerns_id == 1 && e.exams_id == id)
//get by id and concern_id of 1
group eq by eq.concern.concerns_description into OrderGroup
//put in group from db table concerns, field concerns_description 
select new ExamBreakdownViewModel()
{
concerns_description = OrderGroup.Key,
//return collection of on concerns_description
 PercentCount = OrderGroup.Where(Concern1 / Sum)
 //Count how many of each concerns1 and divide by Sum but Not Working.  Not sure what the correct linq or lambda expression would be**
};
vm.TotalConcern1Questions = TotalConcern1Questions.ToList();


return View(vm);

Open in new window


Thanks again for your time, help and patience.  Jay
0
 

Author Comment

by:lovettjay
ID: 41769392
Full Controller:

		public ActionResult ExamBreakDown(int? id)
		{
			if (id == null)
			{
				return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
			}
			exam exam = db.exams.Find(id);
			if (exam == null)
			{
				return HttpNotFound();
			}

			ViewBag.ExamDescription = exam.exams_description;
			ViewBag.ID = exam.exams_id;
			
			ExamBreakdownViewModel vm = new ExamBreakdownViewModel();
			#region Concerns




			IQueryable<ExamBreakdownViewModel> Concern1 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 1 && e.exams_id == id)
														  //get by id and concern_id of 1
														  group eq by eq.concern.concerns_description into OrderGroup
														  //put in group from db table concerns, field concerns_description 
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  //return collection of on concerns_description
															  ConcernCount = OrderGroup.Count()
															  //Count how many of each concerns_description there are
														  };
			vm.Concern1 = Concern1.ToList();

			IQueryable<ExamBreakdownViewModel> Concern4 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 4 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern4 = Concern4.ToList();

			IQueryable<ExamBreakdownViewModel> Concern5 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 5 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern5 = Concern5.ToList();

			IQueryable<ExamBreakdownViewModel> Concern8 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 8 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern8 = Concern8.ToList();

			IQueryable<ExamBreakdownViewModel> Concern9 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 9 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern9 = Concern9.ToList();

			IQueryable<ExamBreakdownViewModel> Concern10 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 10 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern10 = Concern10.ToList();

			IQueryable<ExamBreakdownViewModel> Concern13 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 13 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern13 = Concern13.ToList();

			IQueryable<ExamBreakdownViewModel> Concern14 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 14 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern14 = Concern14.ToList();

			IQueryable<ExamBreakdownViewModel> Concern15 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 15 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern15 = Concern15.ToList();

			IQueryable<ExamBreakdownViewModel> Concern16 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 16 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern16 = Concern16.ToList();

			IQueryable<ExamBreakdownViewModel> Concern17 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 17 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern17 = Concern17.ToList();

			IQueryable<ExamBreakdownViewModel> Concern18 = from e in db.exams
														  join eq in db.exams_questions on e.exams_id equals eq.exams_id
														  where (eq.concerns_id == 18 && e.exams_id == id)
														  group eq by eq.concern.concerns_description into OrderGroup
														  select new ExamBreakdownViewModel()
														  {
															  concerns_description = OrderGroup.Key,
															  ConcernCount = OrderGroup.Count()
														  };
			vm.Concern18 = Concern18.ToList();

			IQueryable<ExamBreakdownViewModel> Concern19 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 19 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern19 = Concern19.ToList();

			IQueryable<ExamBreakdownViewModel> Concern20 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 20 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern20 = Concern20.ToList();

			IQueryable<ExamBreakdownViewModel> Concern21 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 21 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern21 = Concern21.ToList();

			IQueryable<ExamBreakdownViewModel> Concern22 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 22 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern22 = Concern22.ToList();

			IQueryable<ExamBreakdownViewModel> Concern23 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 23 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern23 = Concern23.ToList();

			IQueryable<ExamBreakdownViewModel> Concern24 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 24 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern24 = Concern24.ToList();

			IQueryable<ExamBreakdownViewModel> Concern25 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 25 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern25 = Concern25.ToList();

			IQueryable<ExamBreakdownViewModel> Concern26 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 26 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern26 = Concern26.ToList();

			IQueryable<ExamBreakdownViewModel> Concern27 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 27 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern27 = Concern27.ToList();

			IQueryable<ExamBreakdownViewModel> Concern28 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 28 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern28 = Concern28.ToList();

			IQueryable<ExamBreakdownViewModel> Concern29 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 29 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern29 = Concern29.ToList();

			IQueryable<ExamBreakdownViewModel> Concern30 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 30 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern30 = Concern30.ToList();

			IQueryable<ExamBreakdownViewModel> Concern31 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 31 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern31 = Concern31.ToList();

			IQueryable<ExamBreakdownViewModel> Concern32 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id ==32 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern32 = Concern32.ToList();

			IQueryable<ExamBreakdownViewModel> Concern33 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 33 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern33 = Concern33.ToList();

			IQueryable<ExamBreakdownViewModel> Concern43 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 43 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern43 = Concern43.ToList();

			IQueryable<ExamBreakdownViewModel> Concern44 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 44 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern44 = Concern44.ToList();

			IQueryable<ExamBreakdownViewModel> Concern45 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 45 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern45 = Concern45.ToList();

			IQueryable<ExamBreakdownViewModel> Concern46 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 46 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern46 = Concern46.ToList();

			IQueryable<ExamBreakdownViewModel> Concern47 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 47 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern47 = Concern47.ToList();

			IQueryable<ExamBreakdownViewModel> Concern48 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 48 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern48 = Concern48.ToList();

			IQueryable<ExamBreakdownViewModel> Concern49 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 49 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern49 = Concern49.ToList();

			IQueryable<ExamBreakdownViewModel> Concern50 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 50 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern50 = Concern50.ToList();

			IQueryable<ExamBreakdownViewModel> Concern51 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 51 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern51 = Concern51.ToList();

			IQueryable<ExamBreakdownViewModel> Concern52 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 52 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern52 = Concern52.ToList();

			IQueryable<ExamBreakdownViewModel> Concern53 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 53 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern53 = Concern53.ToList();

		

			IQueryable<ExamBreakdownViewModel> Concern55 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 55 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern55 = Concern55.ToList();

			IQueryable<ExamBreakdownViewModel> Concern56 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 56 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern56 = Concern56.ToList();

		

			IQueryable<ExamBreakdownViewModel> Concern57 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 57 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern57 = Concern57.ToList();

			IQueryable<ExamBreakdownViewModel> Concern58 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 58 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern58 = Concern58.ToList();

			IQueryable<ExamBreakdownViewModel> Concern59 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 59 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern59 = Concern59.ToList();

			IQueryable<ExamBreakdownViewModel> Concern60 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 60 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern60 = Concern60.ToList();

			IQueryable<ExamBreakdownViewModel> Concern62 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 62 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern62 = Concern62.ToList();

			IQueryable<ExamBreakdownViewModel> Concern64 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 64 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern64 = Concern64.ToList();

			IQueryable<ExamBreakdownViewModel> Concern65 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 65 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern65 = Concern65.ToList();

		

			IQueryable<ExamBreakdownViewModel> Concern66 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 66 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern66 = Concern66.ToList();

			IQueryable<ExamBreakdownViewModel> Concern67 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 67 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern67 = Concern67.ToList();

			IQueryable<ExamBreakdownViewModel> Concern68 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 68 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern68 = Concern68.ToList();

			IQueryable<ExamBreakdownViewModel> Concern69 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 69 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern69 = Concern69.ToList();

		

			IQueryable<ExamBreakdownViewModel> Concern70 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 70 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern70 = Concern70.ToList();

			IQueryable<ExamBreakdownViewModel> Concern71 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 71 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern71 = Concern71.ToList();

			IQueryable<ExamBreakdownViewModel> Concern72 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 72 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern72 = Concern72.ToList();

			IQueryable<ExamBreakdownViewModel> Concern73 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 73 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern73 = Concern73.ToList();

			IQueryable<ExamBreakdownViewModel> Concern74 = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 74 && e.exams_id == id)
														   group eq by eq.concern.concerns_description into OrderGroup
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   ConcernCount = OrderGroup.Count()
														   };
			vm.Concern74 = Concern74.ToList();

#endregion 


			IQueryable<ExamBreakdownViewModel> Sum = from e in db.exams
													 join eq in db.exams_questions on e.exams_id equals eq.exams_id
													 //joining two tables to get exams_id
													 where (e.exams_id == id)
													 //passing through ID of clicked exam
													 group e by e.credentials_id into OrderGroup
													 select new ExamBreakdownViewModel()
													 {
														   credentials_id = OrderGroup.Key,
														 ConcernCount = OrderGroup.Count()
														 //ConcernCount from Model, Count total number of concerns of that test 
													 };
			vm.Sum = Sum.ToList();


		


			IQueryable<ExamBreakdownViewModel> TotalConcern1Questions = from e in db.exams
														   join eq in db.exams_questions on e.exams_id equals eq.exams_id
														   where (eq.concerns_id == 1 && e.exams_id == id)
															//get by id and concern_id of 1
														   group eq by eq.concern.concerns_description into OrderGroup
																		//put in group from db table concerns, field concerns_description 
														   select new ExamBreakdownViewModel()
														   {
															   concerns_description = OrderGroup.Key,
															   //return collection of on concerns_description
															   PercentCount = OrderGroup.Where(Concern1 / Sum)
															   //Count how many of each concerns1 and divide by Sum but Not Working
														   };
			vm.TotalConcern1Questions = TotalConcern1Questions.ToList();


			return View(vm);
		}

Open in new window


- Jay
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 41769676
Hi Jay;

Looking at your model ExamBreakdownViewModel it does not look right to mee for example you have all the following properties defined as follows.
public partial class ExamBreakdownViewModel
{
	//list of all the different type of questions
	public List<ExamBreakdownViewModel> Concern1 { get; set; }
	public List<ExamBreakdownViewModel> Concern4 { get; set; }
	public List<ExamBreakdownViewModel> Concern5 { get; set; }
	public List<ExamBreakdownViewModel> Concern8 { get; set; }

Open in new window

where ConcernXX are list of the class they are in and the query that you use to fill them only returns 2 properties, so why are you doing this? You could create a class like this in the model
public class ConcernsInfo
{
    public int ConcernID { get; set; }
    public strung Concerns_Description { get; set; }
    public int ConcernCount { get; set; }
}

Open in new window

which has the info for the object and instead of having multiple queries to the database you can execute one query and return all the information you need.

Currently how many objects are in the list's returned from the queries? Would it be 1?
0
 

Author Closing Comment

by:lovettjay
ID: 41776689
Thanks for your help,

Jay
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question