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

  • Home
  • SEARCH
  • 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 6830201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:35:24+00:00 2026-05-26T22:35:24+00:00

I having a trouble with a query I need to take out the SHIPMENT

  • 0

I having a trouble with a query

I need to take out the SHIPMENT from GetAllOrderData – the same place where you can find POD_DATE and RECEIVE_NAME…but I get an error

Error 1 The name ‘x’ does not exist in the current context

My code is:

public IEnumerable<ReportItemDTO> GetTaskProgress(DateTime targetDate)
{
   try
   {
      var startDate = targetDate.Date;
      var endDate = startDate.AddDays(1);
      OrderDataRepository rep = new OrderDataRepository();

      var query = rep.GetAllOrderData()
                  .Where(x => x.POD_DATE >= startDate && x.POD_DATE <= endDate)
                  .GroupBy(o => o.User)
                  .Select(g => new ReportItemDTO
                    {
                      DriverId = g.Key.Id,
                      PdriverName = g.Key.Name,
                      OrderCount = g.Count(),
                      ReportedOrdersCount = g.Count(o => o.RECEIVE_NAME != null),
                      SHIPMENT = (x.SHIPMENT)
                    } );

      return query;
  • 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-26T22:35:25+00:00Added an answer on May 26, 2026 at 10:35 pm
      SHIPMENT = (x.SHIPMENT)
    

    Well you are within a grouping when you try to make that assignment – there are many shipments in each grouping not just one – in fact all shipments for that particular user. Assuming you want a collection of them you could do:

    Shipments = g.Select( x=> x.SHIPMENT)
    

    Edit:

    If you just want the first shipment for each user (somewhat illogical but fits your data model):

    SHIPMENT = g.Select( x=> x.SHIPMENT).First()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble writing query so that I can query the content of
I'm having trouble building a query. I can do what I want in 3
I'm having trouble creating a query. I need to create a SQL query where
I am having trouble with a SQL query. SELECT t.topicname, m. *, ms.avatar FROM
I'm having trouble with an SQL query in a scope. I need to return
I am having trouble with a sql query. I need to insert a row
I am having trouble and need some help finding a correct SQL query. Here
I am having trouble figuring out how to even start this query. I have
Im having trouble trying to find out why my script wont delete a row
I'm having trouble optimizing this query: SELECT a.id FROM a JOIN b ON a.id=b.id

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.