mistic100 / jQuery-QueryBuilder

jQuery plugin offering an interface to create complex queries
https://querybuilder.js.org
MIT License
1.68k stars 552 forks source link

Autofill rules from a CSV #934

Closed AshrithSher closed 2 years ago

AshrithSher commented 2 years ago

First of all, I really appreciate you all for the super great work you people have been doing. I have values of rules in a CSV file. Whenever I upload a CSV file, my rule's fields should be auto populated with values from that particular CSV file. I did some research and thought setrules might help but I either need an SQL query or JSON to auto-populate using setRules or using setRulesFromSQL. I need your help in auto-generating that SQL query with values from my CSV so that I can use setRulesFromSQL or some other optimised solution to solve my issue. It would mean a lot if you could help me in this regard, thanks in advance.

AshrithSher commented 2 years ago

I got this resolved myself. I read the filter names, operators and values as a 3D matrix from the CSV file and use setRulesFromSQL. Please let me know if you guys have any optimised solution. Thanks a lot again for providing us with such great plugins and all. Thank you.

mistic100 commented 2 years ago

I would have used "getRules", there is no point in using "setRulesFromSQL" which will simply parse the SQL and call "getRules" itself. You are only multiplying the source of potential errors.

The paylod expected by "setRules" is documented https://querybuilder.js.org/#method-setRules => "See an example"