SearchPanes with Editor .Net server side processing.

SearchPanes with Editor .Net server side processing.

jeremyleffjeremyleff Posts: 4Questions: 2Answers: 0
edited May 2022 in SearchPanes

I am using SearchPanes with Editor .Net server side processing, and I am not quite sure I understand the purpose of LeftJoin in the context of SearchPaneOptions. When I look at the actual queries run against the database (MSSQL), I don't see that particular join at all, rather the query that is getting the options for the search pane seems to be using the left join(s) from my the main editor. In fact I can remove the LeftJoin call from the SearchPaneOptions completely and everything still works.

Example:

_editor = new Editor(
                    db, "truck_Load", "Id")
                    .Model<Load>("truck_Load")
    .Field(new Field("StatusLookup.Description")
                .SearchPaneOptions(new SearchPaneOptions()
                    .Value("StatusLookup.Description")
                    .Label("StatusLookup.Description")
                    .Where(q => q
                                .Where("ScheduledShipDate", maxDate.ToString("d"), "<=")
                                .AndWhere("ScheduledShipDate", maxDate.ToString("d"), ">="))
                    .LeftJoin("pr_Lookup_List AS StatusLookup",
                        "StatusLookup.Id = truck_Load.ShipmentStatus",
                        null, null)

    .LeftJoin("pr_Lookup_List AS StatusLookup", "StatusLookup.Id = 
    truck_Load.ShipmentStatus AND StatusLookup.Code = 'ShipmentStatus'")

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    The left join in the options is only needed if the values and the labels are in different tables. For example you might want to have just the values which are used, which means picking them from the host table.

    I agree, it isn't particularly common to use that approach. If you don't need it, don't use it :).

    Allan

Sign In or Register to comment.