Filtering column data while using Custom Data Server results with error

Answered
Gerd Tautenhahn asked on May 3, 2022

Hello,

After my last support ticket, I have implemented a custom data server solution for my project based on your example from here:

https://www.flexmonster.com/doc/pivot-table-with-dot-net-core-server/
https://www.flexmonster.com/doc/introduction-to-custom-data-source-api/
https://github.com/flexmonster/api-data-source

Till now everything worked fine, although I had to adjust some parts of your code in order to pass necessary data needed for my custom data source to work properly (but nothing out of ordinary). Recently I encountered an issue when trying to filter the data inside the columns, it fails and does not really throw any significant exceptions during code execution, but only while parsing the data for 'select' http request (my guess based on what I have found). The only meaningful error message I could get is from scanning the network traffic and here's what I got:

  1. errors{query.filter[0].exclude[0].member: [,…]}
    1. query.filter[0].exclude[0].member[,…]
      1. 0"Error converting value 1579046400000 to type 'OCT.Flexmonster.Models.ValueObject'. Path 'query.filter[0].exclude[0].member', line 1, position 418."
  2. status400
  3. title"One or more validation errors occurred."
  4. traceId"|13d9b65b-4b432e48ec37de43."
  5. type"https://tools.ietf.org/html/rfc7231#section-6.5.1"

At first I thought it might have been related to some kind of data value parsing, but after trying to filter out plain 'string' values I also got errors like these:

Error converting value \"Account 100\" to type 'OCT.Flexmonster.Models.ValueObject'. Path 'query.filter[0].exclude[1].member', line 1, position 426." 

The filtering I'm taking about is simply executed by the UI (I've included some screenshots in the attachments). 

To help you out narrowing down and debugging my problem, I've included every parts of the code that could be relevant to you (see the attachments for 'code.zip). Here I included my custom data source / server implementation on the net backend side as well as angular component with everything set up (some parts may be missing, but you should be able to get the whole context of my use case).

Any help will be appreciated.

Best regards,

4 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 6, 2022

Hello, Gerd,
 
Thank you for reaching out to us.
 
Our team is currently working on your question. We will get back to you soon.
 
Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 6, 2022

Hello, Gerd,

Thank you for giving us some time and providing the detailed information.

We have looked through the files provided in the net_custom_data_serverfolder from your ZIP. We don't see the ValuesJsonConverter.cs file in the JsonConverters directory. It is responsible for converting the ValueObject object to JSON depending on its type. Without it, the server could not parse requests with filters and hierarchies.
As far as the described error mentions converting types, we suppose that it is caused by the absence of ValuesJsonConverter.cs. Do you use it in your project? 

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Gerd Tautenhahn May 9, 2022

Hello Nadia,

Yes you are right, it was in fact a missing ValuesJsonConverter.cs, although I had to adjust your implementation to fit our current json handler (from System.Text.Json to Newtonsoft.Json). Thanks for the help and fast response.

Best regards

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 10, 2022

Hello, Gerd,

Thank you for your feedback.

We are happy to hear that it works for you.

As always, feel free to contact us if other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer