Skip to main content
January 8, 2009
Question

GUI Query Builder for Users

  • January 8, 2009
  • 1 reply
  • 1600 views
Hey all,
For anyone who was following my last post, I did convince my boss to buy CF, so epic win there. I am now starting to replace some our existing software with CF based code. One of the first things we would like to do is setup a "Query builder" type of thing. Basically we have a database with over 100 fields in a particular table. I need some kind of interface that will allow a user to easily build a complex query that can include any number of those fields. Before I start reinventing the wheel I was wondering if anyone had code for something like this already or could point in the direction of a place that might. All it needs to do is put a nice front end on an SQL query basically, and really only for the where statement part of it. We are always going to be selecting the same info, from the same table, but what records we select will be very very different. Thanks in advance.
This topic has been closed for replies.

1 reply

Inspiring
January 8, 2009
Your post has many contradictions.

On the one hand, you want the user to be able to build a complex query that can include any number of fields. On the other, you say, "We are always going to be selecting the same info, from the same table, but what records we select will be very very different", in other words, a simple canned query.

Depending on what you really want to do, it could be as simple as a bunch of check boxes for the select clause and some other inputs for the where clause.
January 8, 2009
Dan,
I know my posts seem a little goofy. It basically boils down to, I have users that are dumb as a box of rocks, who need to be able to build somewhat complex queries.

what I mean by selecting the same fields is that we are always interested in retreiving the same SET of data from the same table. However, what records we want exactly will be very variable. Basically

SELECT * FROM CONTACTS
WHERE [A BUNCH OF CRAZY SH**]

In this case, complex just means a ton of WHERE statments, not so much doing cross table joins or anything. I think I am making decent progress so far actually. It's easier than I thought it might be. Still any suggestions are appreciate. Thanks!
January 8, 2009
Okay, I'm a bit stuck. Basically this tool is to query against Salesforce and build exportable lists. Right now my page finds all fields that exist on the Contact object, and loops over the structure (which i turn into an array) and creates form fields for every updatable peice of data. There are checkboxes, text areas, numeric inputs, and string inputs. I would like to group similar inputs to make it look a little more presentable. Does anyone know how I can sort an array by the value of a certain element? In this case #FormItems [4]# holds the datatype (int, float, textarea, string, etc). I would like to sort my array based on that. Attached is the code for the query builder.