Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
VictorioBerra opened this issue May 3, 2024 · 2 comments · May be fixed by #21
Open

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

VictorioBerra opened this issue May 3, 2024 · 2 comments · May be fixed by #21

Comments

@VictorioBerra
Copy link

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...

@VictorioBerra VictorioBerra changed the title SearchBuilderOptions()/SearchPaneOptions() do not work on SqlServer SearchBuilderOptions()/SearchPaneOptions() generated invalid code on SqlServer May 3, 2024
@VictorioBerra VictorioBerra linked a pull request May 7, 2024 that will close this issue
@AllanJard
Copy link
Contributor

Hi - sorry I haven't been able to reply and look into your various issues and fixes yet. I'm working on other aspects of DataTables that I want to figure out before context switching to this. I will do so before the next release of Editor though.

@VictorioBerra
Copy link
Author

VictorioBerra commented May 7, 2024

@AllanJard no problem, I have created PRs for almost every issue I created now 🎉 hopefully this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants