Find specific column names AND their values.

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Find specific column names AND their values.

    Okay, so I'm working on this project that tracks communities and how they're
    doing. The communities are judged based on their indicators. There are two
    types of these "sustainable" and "essential". Originally, the code did not
    make allowances for N/A's, so it just counted them as "no", which threw off the
    score. I've been brought in to fix this, but I'm trying to figure out the best
    way to do it.

    The user opens up a community for editing, which is basically just a large
    form with values pulled from the database. Then they select all of these
    indicators, which are then put into the database with code like this:


    <cfquery name="Update" datasource="database" dbtype="Oracle80">
    UPDATE DATABASE.REPORT
    SET COMMUNITY = '#Form.Community#',
    AGREEMENT = '#Form.Agreement#',
    AGREEMENT_DATE = '#DateFormat(Form.AgreementDate,"dd-mmm-yy")#',
    AGREE_EXP_DATE = '#DateFormat(Form.AgreeExpDate,"dd-mmm-yy")#',
    STAFF = '#Form.Staff#',
    <!---etc--->
    F_E1 = '#Form.F_E1#',
    F_E2 = '#Form.F_E2#',
    F_E3 = '#Form.F_E3#',
    F_E5 = '#Form.F_E5#',
    F_E6 = '#Form.F_E6#',
    F_E4 = '#Form.F_E4#',
    F_S1 = '#Form.F_S1#',
    F_S2 = '#Form.F_S2#',
    F_S3 = '#Form.F_S3#',
    F_S4 = '#Form.F_S4#',
    F_S5 = '#Form.F_S5#',
    F_COMMENTS = '#Form.FinanceComments#',
    A_E1 = '#Form.A_E1#',
    A_E2 = '#Form.A_E2#',
    A_E3 = '#Form.A_E3#',
    A_E4 = '#Form.A_E4#',
    A_E5 = '#Form.A_E5#',
    A_E6 = '#Form.A_E6#',
    A_E8 = '#Form.A_E8#',
    A_S1 = '#Form.A_S1#',
    A_S2 = '#Form.A_S2#',
    A_S3 = '#Form.A_S3#',
    A_COMMENTS = '#Form.AcctComments#',
    T_E1 = '#Form.T_E1#',
    T_E2 = '#Form.T_E2#',
    T_E3 = '#Form.T_E3#',
    T_E4 = '#Form.T_E4#',
    T_COMMENTS = '#Form.TaxComments#',
    <!---etc--->
    WHERE COMM_ID = #Form.CommID#
    </cfquery>

    So, basically, the fields I'm interested in are [<letter for section>_<'E' for
    essential, 'S' for sustainable><arbitrary number>].

    Further complicating things, <arbitrary number> is not always in order.

    So... I ask you this:

    what's the best way to go through the entire database entry for one community,
    look at each of the names, ensure that the second character is an underscore,
    pull the character after that, and then increment a variable based on whether
    its value is "yes" or "no"?

    walkeraj00 Guest

  2. Similar Questions and Discussions

    1. Getting column data without column names
      Hello all, I'm trying to write a coldfusion program to display account data such as name, address, phone #, etc. I retrieve this data from an ...
    2. counting column and getting column names
      Im using an Access database that will probably be switched over to Oracle later, but I need to find out how to get the number of columns in an...
    3. How do I find the index of a DG column with a specific name?
      I have a column called "notes" which may change position in the datagrid. How do I find the index of this column based on its name?
    4. How to get column names using SQL?
      In article <a06d6e69.0307100719.2e206e69@posting.google.com>, minjie@excite.com says... SYSCAT.COLUMNS To show the columns of this view: ...
    5. how to Add different controls(textBox,DropDownList or some ) in the same column,based upon the value in the previous column (Say second Colum which contain dropdown with some values) ?
      I am new to ASP.NET. I am facing problem with datagrid. I will explain prob now. In the datagrid the first column is name in the second...
  3. #2

    Default Re: Find specific column names AND their values.

    I'm pretty sure it has something to do with query.ColumnList, am I right? Would I need to start another query to do this with the code as it is now?
    walkeraj00 Guest

  4. #3

    Default Re: Find specific column names AND their values.

    Hi

    If you want too get the column names then you can use the getColumns function.
    This Returns an array of strings containing the names of the columns in the query.
    vkunirs Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139