Skip to content

SearchBuilderOptions()/SearchPaneOptions() generated invalid code on SqlServer #18

Description

@VictorioBerra

Modify the sample to the following code

.Field(new Field("sites.name")
    .SearchBuilderOptions(new SearchBuilderOptions()
        .Value("sites.id")
        .Label("sites.name")
        .LeftJoin("sites", "sites.id", "=", "users.site")
    )
)

This works on SQLite not SqlServer/MSSQL.

With SqlServer, you will get "Column '[sites].[name]' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."

Finally, "fixing" this is:

.Field(new Field("sites.name")
    .SearchBuilderOptions(new SearchBuilderOptions()
        .Value("sites.id")
        .Label("MAX(sites.name)")
        .LeftJoin("sites", "sites.id", "=", "users.site")
    )
)

Not sure if that is the appropriate fix though...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions