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 6181135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:58:01+00:00 2026-05-24T00:58:01+00:00

Does anyone know how I can get my results currently in qry IQueryable object

  • 0

Does anyone know how I can get my results currently in qry IQueryable object into a jagged array in the format:

        series:
             [{
                name: '2',
                data: [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
                    }, {
                name: '3',
                data: [1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0]

                }]

My problem is the code I have at the moment wraps double quotes around the 12 element data part, i.e. it looks like this in the debugger on client side:

?result[0]
{…}
[0]: “2”
[1]: “[0,0,0,0,0,0,1,0,0,0,0,0]”
?result[1]
{…}
[0]: “3”
[1]: “[1,0,0,0,0,0,0,0,0,0,0,0]”

The problem is my array contains a single string element rather than an array of 12 numbers.

Here is my controller code that at the moment returns the 12 number part as one big string :

        var qry = from i in _db.Complaints
             where i.Site.SiteDescription.Contains(searchTextSite)
                  && (i.Raised >= startDate && i.Raised <= endDate)
            group i by i.ComplaintNatureTypeId.ToString()
            into grp select new 
            {
                Type = grp.Key,
                Count = "[" + grp.Where(c => c.Raised.Month == 1).Count() + "," + 
                        grp.Where(c => c.Raised.Month == 2).Count() + "," +
                        grp.Where(c => c.Raised.Month == 3).Count() + "," + 
                        grp.Where(c => c.Raised.Month == 4).Count() + "," +
                        grp.Where(c => c.Raised.Month == 5).Count() + "," + 
                        grp.Where(c => c.Raised.Month == 6).Count() + "," +
                        grp.Where(c => c.Raised.Month == 7).Count() + "," + 
                        grp.Where(c => c.Raised.Month == 8).Count() + "," +
                        grp.Where(c => c.Raised.Month == 9).Count() + "," + 
                        grp.Where(c => c.Raised.Month == 10).Count() + "," +
                        grp.Where(c => c.Raised.Month == 11).Count() + "," + 
                        grp.Where(c => c.Raised.Month == 12).Count() + "]"

            };


        return Json(qry.ToArray(), JsonRequestBehavior.AllowGet);
  • 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-24T00:58:02+00:00Added an answer on May 24, 2026 at 12:58 am

    You need to pass an object and Json will serialize it to a JSON string.

    Count = new int[] {
       grp.Where(c => c.Raised.Month == 1).Count(),
       grp.Where(c => c.Raised.Month == 2).Count(),
       grp.Where(c => c.Raised.Month == 3).Count(),
       grp.Where(c => c.Raised.Month == 4).Count(),
       grp.Where(c => c.Raised.Month == 5).Count(), 
       grp.Where(c => c.Raised.Month == 6).Count(),
       grp.Where(c => c.Raised.Month == 7).Count(), 
       grp.Where(c => c.Raised.Month == 8).Count(),
       grp.Where(c => c.Raised.Month == 9).Count(), 
       grp.Where(c => c.Raised.Month == 10).Count(),
       grp.Where(c => c.Raised.Month == 11).Count(), 
       grp.Where(c => c.Raised.Month == 12).Count()
    }
    

    Or you could do something like:

    Count = Enumerable.Range(1, 12).Select(x => grp.Where(c => c.Raised.Month == x).Count())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how I can get a format string to use bankers rounding
Does anyone know how I can get rid of the following assembler warning? Code
Does anyone know how I can get the phone number of the device I
Does anyone know how I can get the helpful Eclipse popups with javadoc when
Does anyone know how I can get the value of an input box, without
Does anyone know where I can go to get a list of the new
Does anyone know how I can force CanExecute to get called on a custom
Does anyone know how can I cut a string and then assign into an
Does anyone know how can I detect the browser type in css? What I
Does anyone know where can I find recent data on PHP4 vs PHP5 market

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.