Parameter with comma

#1

Hello.

I'm making a application with Radzen that integrates with an ERP and on the MSSQL database of the ERP there is a necessary data field that I need with a comma inside of the string.
i tried to use this string as a parameter for the next page and After that THe next table keeps loading and I get a bad request error.
I can I handle this type of parameters ?

Thank you,
kind regards

0 Likes

#2

Hi,

Can you provide more info where is the parameter with comma? Is for page or a data-source method invoke?

Thanks,
Vladimir

0 Likes

#3

Hi.

I'm passing it from a event table row select to a data source query filter that feeds another table in a new page.

Thanks

0 Likes

#4

When I open the detail on the browser console I get this error:

{"error":{"code":"","message":"The query specified in the URI is not valid. Syntax error at position 26 in 'ststamp eq Adm19060646801,821542954 '.","details":[],"innererror":{"message":"Syntax error at position 26 in 'ststamp eq Adm19060646801,821542954 '.","type":"Microsoft.OData.ODataException","stacktrace":" at Microsoft.OData.UriParser.ExpressionLexer.ValidateToken(ExpressionTokenKind t)\r\n at Microsoft.OData.UriParser.UriQueryExpressionParser.ParseExpressionText(String expressionText)\r\n at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilterImplementation(String filter, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)\r\n at Microsoft.OData.UriParser.ODataQueryOptionParser.ParseFilter()\r\n at Microsoft.AspNet.OData.Query.FilterQueryOption.get_FilterClause()\r\n at Microsoft.AspNet.OData.Query.Validators.FilterQueryValidator.Validate(FilterQueryOption filterQueryOption, ODataValidationSettings settings)\r\n at Microsoft.AspNet.OData.Query.Validators.ODataQueryValidator.Validate(ODataQueryOptions options, ODataValidationSettings validationSettings)\r\n at Microsoft.AspNet.OData.EnableQueryAttribute.ValidateQuery(HttpRequest request, ODataQueryOptions queryOptions)\r\n at Microsoft.AspNet.OData.EnableQueryAttribute.<>c__DisplayClass1_0.b__3(ODataQueryContext queryContext)\r\n at Microsoft.AspNet.OData.EnableQueryAttribute.ExecuteQuery(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, Func2 modelFunction, IWebApiRequestMessage request, Func2 createQueryOptionFunction)\r\n at Microsoft.AspNet.OData.EnableQueryAttribute.OnActionExecuted(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, IWebApiRequestMessage request, Func2 modelFunction, Func2 createQueryOptionFunction, Action1 createResponseAction, Action3 createErrorAction)"}}}

0 Likes

#5

This exception means that the $filter parameter contains invalid value. What is the actual value that the HTTP request is made with? You can see that in your browser developer tools (in the Network tab).

0 Likes

#6

Hello Atanas.

The construction query with parameter is here:
http://localhost:5000/odata/PHC/Tarefas?$filter=contains(ststamp,Adm19060646801,821542954%20)&$top=10&$skip=0&$count=true
The parameter that I want to pass is 'Adm19060646801,821542954'

0 Likes

#7

these are the configurations on Radzen and the outputs

0 Likes

#8

You can try ${encodeURIComponent(parameters.yourparameter)}

0 Likes

#9

Where should I use this code? into the query builder ?
Thanks

0 Likes

#10

Yes, just change ${parameters.yourparameter} to ${encodeURIComponent(parameters.yourparameter)}

0 Likes

#11

I think it doesn't like the commas. I got error again
The query specified in the URI is not valid. Syntax error: character '%' is not valid at position 25 in 'ststamp eq Adm19060646801%2C821542954%20'.","details":[],"innererror":

0 Likes

#12

You may need to use it as string: '${encodeURIComponent(parameters.yourparameter)}' or '${parameters.yourparameter}'. Like this:
https://services.odata.org/V4/Northwind/Northwind.svc/Customers?$filter=CustomerID%20eq%20'AL,FKI'

0 Likes

#13

Hi Enchev.

This '${parameters.yourparameter}' worked in this case.

Thanks a lot!

0 Likes