Updates from March, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • montelof 9:34 am on March 16, 2011 Permalink | Reply
    Tags: count, distinct, groupby, lambda, , row_count   

    GroupBy two fields,correlate another entity, Count matching rows, show row_number using Lambda 

    I want to count the Tickets owned by every employee, having two Entities,related by Login_ID, so I have first to get the distinct values from the first list, then count the matching rows of the second list, I also want to assign an image url to each employee so I need a row_count like variable, also the related tickets to each employee must match the Team assigned to the employee so the correlated query must consider two fields:

    int index = 0;

    var workload = grouplist.GroupBy(j => new { j.LOGIN_ID, j.FULL_NAME,j.TEAM_NAME})

                    .Where(k => k.Key.TEAM_NAME == membergroup)

                    .Select(i => new

                    {

                        CoreID = i.Key.LOGIN_ID,

                        TicketCount = tickets

                            .Where(k => k.Assignee_Login_ID == i.Key.LOGIN_ID   &&                      k.Assigned_Group==i.Key.TEAM_NAME)

                            .Count(),

                        Assignee = i.Key.FULL_NAME,

                        url = @"~\images\man_" + (1 + (index++) % 5) + ".png"

                    }).ToList();           

    I choose to use Lambda instead of Linq because of simplicity, Ill post another example using left outer join using Linq in the next one.   

     
  • montelof 8:10 am on March 9, 2011 Permalink | Reply
    Tags: , programing   

    OCIEnvCreate failed with return code -1 but error message text was not available. 

    If anyone is getting this error it could be caused for a setting in the project properties:

    change update Database to False and the error will go away.

     
    • waqar hussain 2:18 am on July 26, 2011 Permalink | Reply

      project manager model property windoq, how can i open window,please help me, i am in graet trouble.

      • montelof 9:38 am on July 26, 2011 Permalink | Reply

        if you are using VS 2008 , just select the project in solution explorer, the properties window will show its properties, there, you can then change the setting for UpdateDatabase from false to True.
        hope this helps.

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel