mjoin in mvc app getting 'Object reference not set to an instance of an object.'"

mjoin in mvc app getting 'Object reference not set to an instance of an object.'"

rschneiderrschneider Posts: 2Questions: 1Answers: 0

I have loaded the demo of datatables demo into my app and it works but using my fields in the mjoin it fails. stackTrace shows

at DataTables.MJoin.Data(Editor editor, DtResponse response)
at DataTables.Editor._Get(Object id, DtRequest http)
at DataTables.Editor._Process(DtRequest data)
at DataTables.Editor.Process(DtRequest data)
at DataTables.Editor.Process(NameValueCollection data, String culture)

my mjoin looks like this.

     .MJoin(new MJoin("AlternateExperience")
                    .Link("ClerkShipCourseTarget.TargetId", "AlternateExperiencetoTarget.ClerkshipCourseTarget_id")
                    .Link("AlternateExperience.id", "AlternateExperiencetoTarget.AlternateExperience_id")
                    .Model<JoinLinkTableModel.JoinAccessModel>()
                    .Order("AlternateExperience.name")
                    .Field(new Field("id")
                        .Options(new Options()
                            .Table("AlternateExperience")
                            .Value("id")
                            .Label("name")
                                 )
                          )
                     )

the working mjoin looks like this.

   .MJoin(new MJoin("dept")
                    .Link("users.id", "user_dept.user_id")
                    .Link("dept.id", "user_dept.dept_id")
                    .Model<JoinLinkTableModel.JoinAccessModel>()
                    .Order("dept.name")
                    .Field(new Field("id")
                        .Options(new Options()
                            .Table("dept")
                            .Value("id")
                            .Label("name")
                        )
                    )
                )

I have even tried making the ClerkshipCourseTarget id just id and still get same error.

Answers

  • rschneiderrschneider Posts: 2Questions: 1Answers: 0

    this is my table structure. if I remove the mjoin everything else loads fine.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited May 2022
    ClerkShipCourseTarget.
    

    should be:

    ClerkshipCourseTarget.
    

    We quote all identifiers, so the case is important.

    Hopefully that should do it.

    Allan

Sign In or Register to comment.