-
Notifications
You must be signed in to change notification settings - Fork 161
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
[Question] How to pass a string array parameter to a custom function? #1003
Comments
Can you elaborate on what type of function you are trying to create there? I know this doesn't answer the original question, but I'm just curious about what type of logic you want. |
@AndriiLesiuk In OData lib parser, it starts to parse the parameter value, then uses the function name and parsed value to match the defined functions. Since there's no parameter type information at the beginning when parsing the parameter value, ODL parses the 'collection value' as a single string value. As a result, it can't match the second parameter type since you define the second parameter type as a collection of string. ODL should fix it by converting the single string value into a collection of string. Or parse the "string literal" into a collection if it's a "collection literal". Would you please help to file an issue at odata.net repo? of course, as a workaround, you can just define the second parameter type as Edm.String, then in your customized filter binder, process the single string value into a collection or others. For example: |
I want to create a custom function that will filter one property againts multiple values: |
I did not understand what problem you mean. As for passing a simple string and then parsing it into a collection - yes, this option works well, thanks. |
@julealgon @xuzhg /odata/MyTable?$filter=propertyName in ('Bob', 'Rob') But the requirements do not always fall under a logical understanding (in my case). |
Forget it. I filed an issue here: OData/odata.net#2712 |
|
@xuzhg |
Hi
I am currently working on creating a custom $filter function:
[(https://github.com//issues/1000)]
I want to pass a string array to it as a parameter:
/odata/MyTable?$filter=Custom.in(Name, ['Bob', 'Eric', 'John'])
This is my code in which I add my custom function and its signature:
But when I submit my request, I get this error:
My question is what exactly am I doing wrong and how do I implement passing an array of strings as a parameter?
How to configure custom function signature?
Thanks.
The text was updated successfully, but these errors were encountered: