Devexpress loadOptions parse filter array, how to handle in serverside
Anyone know how to parse the array or restructure to make it easier
the syntax
var filter = [
["Product_Current_Inventory", "<>", 0],
"or",
[
["Product_Name", "contains", "HD"],
"and",
["Product_Cost", "<", 200]
]
]
8 Replies
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
[
["Product_Current_Inventory", "<>", 0],
"or",
[
["Product_Name", "contains", "HD"],
"and",
["Product_Cost", "<", 200]
]
]
oh yeah this is the format given by devexpress when you make remoteOperation = true and its part of an object return by the customStore. I am just trying to find a way to reformat this into somethinge easier to work with with the databasde
@friedice
You've only reiterated the original post, not added any details that would make it easier to understand what you're doing.
What is devexpress?
What frameworks / etc are you using serverside? Any ORM or raw SQL?
Because this looks to be some kind of query builder and without knowing how you're interacting with your database we can't really give suggestions.
raw sql
devexpress is a https://js.devexpress.com/React/Documentation/ApiReference/Data_Layer/CustomStore/LoadOptions/
DevExtreme React - CustomStore LoadOptions - DevExtreme React Docum...
Discover the capabilities of our component and all available component via our online developer guides, code snippets, and interactive demos.
its like a frontend library that handles UI/ and client side logic
for those ui components
im trying to do filter serverside, so it gives me this object
thats quite hard to parse
so basically i want to transform that into raw sql
Well, it'd be easy to make some kind of
QueryPredicate
class that is created by parsing that object, which you could .ToString()
(or create a .ToSql()
method) to turn into a valid query predicate.