Hello,
As a follow-up to my question from September, we've been researching our possibilities regarding usage of DataServer DLL as our middle ground between the database and the UI. As a result I do have a major question or let say concern when it comes to using it for our use-cases.
Is it be possible to pass custom data to the Flexmonster API Controller or a Custom Parser (preferably directly from the UI)? After a quick research, we haven't found a clear way to do so. Our use case is that we do have multiple database connection strings and many different database to get the data from under one application instance. This information about available connections and databases can be changed during application lifetime so it is not really feasible to specify our 'Datasources' in the app settings. We tried to use a Custom Parser approach, but we haven't found a clear way to pass our dynamic data directly to it. This dynamic data would be a set of around 3 unique strings, which then would be used by our app to get the correct connection string, database and stored procedure to fetch the data from.
So in short we would like to pass additional string data to the Flexmonster DataServer (preferably directly from the UI) without a necessity to create additional entries inside app settings 'Datasources' collection. After getting the information, we would then fetch our data from the stored procedure (executing of stored procedure would be independent from the Flexmonster whatsoever, our app would be responsible for it, the important part is only getting the data) and then for example tailor the result data in a similar fashion to how it was done in case of Custom Parser example. This way we could speed up the process of loading the data inside the UI.
Would it be possible to achieve anything like it? Any tips or hints towards the possible solution will be much more than appreciated.
Best regards
Hello, Gerd,
Thank you for reaching out to us.
It is possible to pass custom additional data to the Data Server using customizeAPIRequest
. Check out our documentation to find more information: https://www.flexmonster.com/api/customizeapirequest/.
Kindly note that you may not only use requestHeaders
in your case but also set additional parameters to the requestBody
.
Speaking of passing directly from the UI, you can create an input that passes necessary data to the API request.
Please let us know if such an approach would work for your case. Looking forward to your response.
Kind regards,
Nadia
Hello Nadia,
Thanks a lot for your response, customizeAPIRequest was exactly the thing I was looking for and now I'm able to pass my data to the custom parser.
However I do have another problem - Like I said in my previous post I do have a lot of different stored procedures which I'm using as a source to feed the grid with. So what I'm trying to do, is to use one custom parser which is executing different stored procedures (based on my data from customizeAPIRequest). However due to the current cache mechanism (that's what I'm guessing) which is enabled by default in your library, the Parse method of a custom parser is only executing once, which means the reports that are generated are based on which report I choose to generate first after starting the application. Every other render of grid uses the data from the first call / flexmonster grid, since the Parse method of custom parser is not executed for them.
So my question is - Is there a way to force the Parse method of custom parser / clear the cache or anything like that, to force the fetch process during given api request? I've tried to use a DataRefreshTime as well as CacheSizeLimit which does not help the way I would want to. The first one seems to be working, but I do not want to tie the refresh to some kind of timeout, since I would rather have a on demand option. The second property seems to not be working as I think it should -
According to the last answer from this question:
The CacheSizeLimit when set to 0 should disable the cache mechanism altogether, but from my experience the custom parser is not trying to re do the fetching of data in such scenarios. So I though that maybe the cache is not a problem here and something else is responsible for my issue?
To sum it up - is there a way to force the Parse method of custom parser to be executed during flexmonster api requests?
Best regards
Hello, Gerd,
Thank you for your response.
The issue is that the Custom Parser was not designed to work with dynamic datasets. Therefore, in your case, we suggest you implement the Custom data source API – our custom communication protocol that allows you to retrieve data from a server to Flexmonster Pivot. You can find a sample project in our documentation: https://www.flexmonster.com/doc/pivot-table-with-dot-net-core-server/.
Please let us know if such an approach would work for your case. Looking forward to your response.
Kind regards,
Nadia
Hello, Gerd
Hope you are doing well.
We were wondering if such an approach meets your needs.
Looking forward to your feedback.
Kind regards,
Nadia
Hello, Gerd,
Hope you are doing well.
Just checking in to ask if our solution was helpful.
Looking forward to hearing from you.
Kind regards,
Nadia
Hello Nadia,
sorry for a late response, but we were able to create a custom implementation of Data Server based on your sample located under following link.
https://github.com/flexmonster/api-data-source
As a result we end up not having any kind of dependency to your .net flexmonster library on our backend. We had to create a custom parser which is able to understand our specific datasource flow by reading the data from our stored procedures dynamically, without the need to specify any kind of datasource definition under app.setttings
as well as during runtime. Additionally we also had to tinker around with the cache mechanism, but for now everything looks promising and is working just fine. We won't hesitate to contact you once we have more questions and concerns regarding your library.
Best regards
Hello,
Thank you for your response.
Our team is glad to hear that everything works fine for your case.
Feel free to contact us if other questions arise.
Kind regards,
Nadia