Please see attached file for screenshots of the report and codes. I get error after applying filter on any of the report fields. We use "Referencing the Data Server as a DLL" approach to implement custom data source API. The select API call never reaches server side breakpoint. We use SQL Server database query as index. Please let me know if you need more info.
Error
Custom data source API: request error on 'https://localhost:5001/api/v1/Reports/select'.
[object Object]
The following are the error message from Chome Devtool
query.filter.value[0].field.0: [,…]
"Could not create an instance of type Flexmonster.DataServer.Core.Models.Select.BaseFilter. Type is an interface or abstract class and cannot be instantiated. Path 'query.filter.value[0].field', line 1, position 113."
status: 400
title: "One or more validation errors occurred."
custom data source API:
[Route("select")]
[HttpPost]
public IActionResult PostSelect([FromBody] SelectRequest request)
{
var response = _flexmonsterApiService.GetAggregatedData(request);
return new JsonResult(response);
}
Hello, Peter!
Thank you for reaching out to us.
Could you please let us know if the described filtering behavior is reproducible while following our guide about using the Data Server as a DLL?
We also kindly ask you to try attaching the screenshots and codes one more time. Any additional information would help us greatly to continue the investigation.
Looking forward to hearing from you.
Kind regards,
Solomiia
Hi Solomia,
The filter works when I use you sample project in our guide about using the Data Server as a DLL.
Your sample project uses custom data source but we use SQL Server as data source. Does the filter support SQL server? I also attach the pdf file which has screen shot and codes.
Thanks
Your sample project data source setting:
"Type": "custom", "Indexes": { "custom-index": null }
Our custom API data sources setting:
{
"Type": "database",
"DatabaseType": "mssql",
"ConnectionString": "Server=localhost;Database=CAY_WebApp_QA3_FT;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework",
"Indexes": {
"index_personnel": {
"Query": "select * from [Person].[PersonnelReportView]",
"filters": true
}
}
}
Hello, Peter!
Thank you for the provided details.
Our team is currently working on your case. We will be back to you with the updates soon.
Kind regards,
Solomiia
Hello, Peter!
Thank you for giving us some time.
Our team could not reproduce the described behavior on our side.
As a next step, we kindly request your assistance with the following points:
customizeAPIRequest
API call? If so, please provide us with more details.This information would help us greatly to continue the investigation.
Looking forward to hearing from you.
Kind regards,
Solomiia
Hello, Peter!
Hope you are doing well.
Our team is wondering if you had a chance to look through our previous response. Could you please provide us with the mentioned information so we can continue the investigation?
Looking forward to hearing from you.
Kind regards,
Solomiia
Hi Solomia,
1. We do send information to the server using customizeAPIRequest
API call. Bearer token is added for security reason
function customizeAPIRequestFunction(req) {
req.requestHeaders = {
"Authorization": `Bearer ${authServ.getTokenFromLocalStorage()}`,
};
return req;
}
2. Please see attached file for 400 error detail
There is another attached file for screen shot of 400 error:
"Could not create an instance of type Flexmonster.DataServer.Core.Models.Select.BaseFilter. Type is an interface or abstract class and cannot be instantiated. Path 'query.filter.value[0].field', line 1, position 113."
Hello, Peter!
Thank you for getting back to us.
As we can see from the provided information, the issue is not caused by the data sent in customizeAPIRequest. Therefore, we kindly ask for the full /select
request with 400 response from the first screenshot.
Here is a brief instruction on how to save the request in a JSON file in a Chrome browser:
Network
tabPayload
tabview source
button near the "Request Payload" labelThis information would help us greatly to proceed with the investigation.
Looking forward to hearing from you.
Kind regards,
Solomiia
Hi Solomia,
I put raw json text here and in attached file
{"type":"select","index":"index_database","query":{"aggs":{"values":[]},"filter":{"type":"and","value":[{"field":{"uniqueName":"EmailAddress"},"exclude":[{"member":""}]}]},"fields":[{"uniqueName":"FirstName"},{"uniqueName":"LastName"},{"uniqueName":"EmailAddress"},{"uniqueName":"PersonnelIdentifier"},{"uniqueName":"ActualSalary"},{"uniqueName":"PersonTitleDescription"},{"uniqueName":"PersonnelTypeName"}]},"page":0}
Hello, Peter!
Thank you for the provided /select request.
Our team has researched possible reasons for the described filtering behavior and come to the conclusion that it can be caused by serializing/deserializing JSON.
We had a similar case in the following thread: https://www.flexmonster.com/question/implementing-the-api-controller/.
In our Flexmonster Data Server DLL project, we use our custom System.Text.Json.Serialization
package to serialize/deserialize JSON objects. If there is another JSON serializer used in your project, we think it can be the cause of such filtering behavior.
Could you please check the JSON serializers used in your project and let us know if our assumptions are correct?
Looking forward to hearing from you.
Kind regards,
Solomiia
Hello, Peter!
Hope you are doing well.
Just checking in to ask if you had some time to check out the provided thread. Could you please let us know if it was helpful and if the issue was caused by serializing/deserializing the JSON files?
If further investigation is needed, please provide us with the following details:
1. Version of Flexmosnter.
2. Version of the Data Server DLL.
3. Your implementation of the handshake, if it is present.
Looking forward to hearing from you.
Kind regards,
Solomiia