AnsweredAssumed Answered

My university uses a custom column called "FinalGrade".  The column id/user id lookup filter type is not working for getGrades().  Can you help me find out why not?

Question asked by ms0054694 on Apr 7, 2017
Latest reply on Apr 10, 2017 by ms0054694

My code is as follows.  It does not retrieve any scores when the score filtertype is 2 (filter by column id and user id):

 

                    ColumnFilter cf = new ColumnFilter();

                    cf.filterType = 1;

                    cf.filterTypeSpecified = true;                   

                    ColumnVO[] grdcol = grd.getColumns(courseId, cf);

                    MessageBox.Show(grdcol.Length.ToString() + " is length of grade column");

                    columnid = "";

                    //-------------------------Locate final grade column name--------------------------------------//

                    foreach (ColumnVO col0 in grdcol)

                    {

                        try

                        {

                            if ((col0.columnName.Equals("FinalGrade") )) //"FinalGrade"

                            {

                                columnid = col0.id;

                                MessageBox.Show("column id found as " + columnid.ToString());

                            }

                        } catch (Exception ex)

                            {

                            }

                    }

                

 

 

MembershipFilter mf = new MembershipFilter();

                    mf.filterType = 2; //6;

                    mf.filterTypeSpecified = true;

                    mf.courseIds = new string[] {courseId};

                        CourseMembershipVO[] memberships = crm.loadCourseMembership(courseId, mf);

                        ScoreVO[] scores;

                        ScoreFilter scorefilt = new ScoreFilter();

                            scorefilt = new ScoreFilter();

                            scorefilt.filterTypeSpecified = true;

                            scorefilt.filterType = 2; //course id 1, user id 8, member id 6, 5 member id + colum id, 2 = column id and user id  (works with option 1, but NOT with column id and user id)

 

                            scorefilt.columnId = columnid;

                            scorefilt.userIds = new string[] { memberships[0].userId};

                            List<string> useridlist = new string[] { memberships[0].userId }.ToList();

                            int ist; //add all membership user ids to array

                            for (ist = 1; ist < memberships.Length; ist++)

                            {

                                useridlist.Add(memberships[ist].userId);

                            }

                            scorefilt.userIds = useridlist.ToArray();           

 

 

                                scores = grd.getGrades(courseId.ToString(), scorefilt);

                            int n = 0;

                            string firstid = "";

                            foreach (ScoreVO sc1 in scores)

                            {

                                        MessageBox.Show( sc1.grade.ToString());

                            }

Outcomes