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

Relation filter problem #485

Open
crisleiria opened this issue Feb 16, 2023 · 0 comments
Open

Relation filter problem #485

crisleiria opened this issue Feb 16, 2023 · 0 comments

Comments

@crisleiria
Copy link

Hello,

I am getting the same error from this issue #455, but from a dexexpress datagrid. Same scenario kpi table as a one to many relation to section table.

AppServiceProvider.php

Lodata::discoverEloquentModel(Kpi::class);
Lodata::discoverEloquentModel(Section::class);
Lodata::getEntitySet('Kpis')->discoverRelationship('section');

relation on Model Kpi.php

#[LodataRelationship]
public function section()
{
  return $this->belongsTo(Section::class,'section_id');
}

devexpress datasource object

dataSource : {
        store : {
            type : 'odata',
            url : '/odata/kpis',
            key: 'id',
            version : 4,
            beforeSend: function (e) {
                e.headers = {
                    'OData-Version': '4.0',
                };
            },
        },
        expand : ['section']
    }

It work, data is displayed. But when I try to search the name field on section object, I am getting the error:

E4018 - The server has returned a non-numeric value in a response to an item count request. See: http://js.devexpress.com/error/22_2/E4018

And this is the json from server

{
    "@context": "http://localhost:81/odata/$metadata#Kpis",
    "value": [OData-error: {
            "code": "expression_parser_error",
            "message": "Encountered an invalid symbol at: contains(tolower(section/>n<ame),'example')",
            "target": null,
            "details": [],
            "innererror": {}
}

this is the request made by the data grid component

http://localhost:81/odata/Kpis?$filter=contains(tolower(section/name),'example')&$top=0&$count=true

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

No branches or pull requests

1 participant