Skip to main content
Inspiring
August 20, 2008
Question

Form Generator - Help with Query

  • August 20, 2008
  • 1 reply
  • 620 views
I am seeking help with a form generator app that I am working on...

There are 2 tables: Campaign & Campaign Forms

Each campaign will have one or more forms. The table Campaign Forms consists of all the fields that the form may have with yes/no. (fname, lname, email, address, etc etc...)

For example: to generate a short form of only Fname, Lname and Email, then i can do so by checking those fields in the DB.

The question is, I am struggling with the query. How do I get ONLY those fields which are checked true?

Thank you in advance everyone.

JT
PS: please send a private msg and i can send a test DB. thx
    This topic has been closed for replies.

    1 reply

    Participating Frequently
    August 20, 2008
    quote:

    For example: to generate a short form of only Fname, Lname and Email, then i can do so by checking those fields in the DB.
    What do you mean by ..checking those fields in the DB?

    Phil
    Inspiring
    August 20, 2008
    All the fields in the DB are Yes/No

    Fname, Lname, Email etc... so basically i set them true to generate the form.

    On the front end, i want to run a query on the forms table to return only those fields which are true and then display the form...

    thanks
    Participating Frequently
    August 21, 2008
    OK, I am assuming now that you are using an Access database. (It is a good idea to post that kind of information up front when asking for help, since it helps narrow things down.)

    I haven't used Access with ColdFusion for a few years now, but I believe that the Yes/No datatype equates to a type bit (CF_SQL_BIT ?) where yes=1 and no=0. I suppose that you can query the Campaign Forms table and use CFIF tags to drive display of the field(s) in your output HTML form anywhere that the queried field = 1. In other words, you would have to select all of the fields in your query to be able to check which ones were "Yes" and "No", then use the results of that query to drive what is displayed in your display.

    Phil