Folks,
I'm looking to build a piece of PHP5 UI that I'm pretty sure is common to a bunch of applications. Basically, it's an expression builder that allows users to specify expressions combined through logical operators (AND/OR), like this:
Ideally, a system like that would allow me as a programmer to specify the list of parameters that the user can pick (columns) and the data type for each. It would also provide a nice, user-friendly interface for defining expressions like that - I'm imagining something like a table, where each row has several pickers:
[Column] [Condition] [Value] [AND/OR] [Column] [Condition] [Value] [AND/OR] ...
Do you know of an open-source component that does something like that? Or maybe a part of this kind of functionality?
A word of caution. These types of generic expression builders are commonly thought of as excellent solutions to a variety of user problems. The thinking tends to go along these lines:
This is not necessarily a bad idea, but what we have found at my company is that non-techie users have surprising difficulty understanding and building expressions more complex than a group of ANDS or a group of ORS. This is hard for us programmers to grasp, as most of us probably had an intuitive understanding of boolean logic even before we learned to program.
I would recommend that you not try to give them complete flexibility to create whatever expression they want, and instead you put together a UI that lets you the programmer define something more complicated on the back-end but gives the user simple choices on the front-end. This is easier said than done, obviously.
Remember - sometimes the difficulty for end users isn't the fact that they don't know the right syntax to express their idea in. More often it's because they don't even know how to formulate their thoughts in an unambiguous way, even if they were provided an easy way to do so.
NOTE: I'm not saying the end users are always morons - just that their minds may work differently from us crazy developers.
This isn't exactly a component, but you might take a look at the Conditions tab of the Shopping Cart rule builder in Magento for a solid PHP implementation of this type of functionality. It is customized towards e-commerce, so it is not a generic database overlay, but it does have a great condition builder interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With