Query help requested

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

  1. #1

    Default Query help requested

    My boss has decided that he wants to mimic Gantt charts in our database, but
    he's adamant about using the db so people can search. So, I've built
    [url]http://www.avmet.com/wxreqs/ProdImp_in.cfm[/url]. He would like to be able to pass
    the task value as well, as coded at
    [url]http://www.avmet.com/wxreqs/TestProdImp_in.cfm[/url] and that's where I need some
    help.

    The table with the task information contains the following information:

    Product Order TaskID Indent
    Prod1 1 T-01 0
    Prod1 2 T-02 1
    Prod1 3 T-03 2
    Prod1 4 T-04 1
    Prod2 1 T-02 0
    Prod2 2 T-03 1

    and so forth. The "order" field is a sequentially numbered field that forces
    the results to always display in that order for that product. Unfortunately,
    the tasks are not always going to be the same level of indent -- some product
    will have a task as a top level, another may have the same task as a subtask.

    The query passes the Product variable, and the TaskID variable (either or both
    or none can be selected). I've pasted my table code below. It works just fine
    when no variables are passed, or if a product is passed.

    I understand that when a specific task is chosen, it grabs only that one line
    of code. How can I get it to grab all of the subtasks as well? I'm guessing
    it needs to be a "do until 0" or something on the indent column -- am I on the
    right track?



    <CFIF #ProductQ.RecordCount# IS NOT '0'>
    <CFOUTPUT>
    <TABLE border="2">
    <TR>
    <TD CLASS="menuhead">Count</td>
    <CFIF #form.ProdID# IS "">
    <TD CLASS="menuhead">Product/<BR>Capability</td>
    </cfif>
    <CFIF #form.ImpTaskID# IS "">
    <TD CLASS="menuhead">Implementation<BR>Task</td>
    </cfif>
    <TD CLASS="menuhead">Subtask</td>
    <TD CLASS="menuhead">Sub-<BR>subtask</td>
    <TD CLASS="menuhead">Responsible<BR>Organization</td>
    <TD CLASS="menuhead">Date<BR>Due</td>
    <TD CLASS="menuhead">Complete?</td>
    </TR>
    </CFOUTPUT>
    </CFIF>
    <CFOUTPUT QUERY="ProductQ">
    <CFIF #ProductQ.Indent# IS "0">
    <TR>
    <td align="CENTER" valign="CENTER" class="table">#CurrentRow#</td>
    <CFIF #form.ProdID# IS "">
    <TD CLASS="table">#Product#</td>
    </cfif>
    <CFIF #form.ImpTaskID# IS "">
    <TD CLASS="table">#ImpTask#</td>
    </cfif>
    <TD class="table"></td>
    <TD class="table"></td>
    <TD class="table">#OrgResp#</td>
    <TD align="CENTER" valign="CENTER" class="table">#DateDue#</td>
    <TD align="CENTER" valign="CENTER" class="table">#Completed#</td>
    </TR>
    </cfif>
    <CFIF #ProductQ.Indent# IS "1">
    <TR>
    <td align="CENTER" valign="CENTER" class="table">#CurrentRow#</td>
    <CFIF #form.ProdID# IS "">
    <TD CLASS="table">#Product#</td>
    </cfif>
    <TD CLASS="table"></td>
    <TD class="table">#ImpTask#</td>
    <TD class="table"></td>
    <TD class="table">#OrgResp#</td>
    <TD align="CENTER" valign="CENTER" class="table">#DateDue#</td>
    <TD align="CENTER" valign="CENTER" class="table">#Completed#</td>
    </TR>
    </cfif>
    <CFIF #ProductQ.Indent# IS "2">
    <TR>
    <td align="CENTER" valign="CENTER" class="table">#CurrentRow#</td>
    <CFIF #form.ProdID# IS "">
    <TD CLASS="table">#Product#</td>
    </cfif>
    <TD CLASS="table"></td>
    <TD class="table"></td>
    <TD class="table">#ImpTask#</td>
    <TD class="table">#OrgResp#</td>
    <TD align="CENTER" valign="CENTER" class="table">#DateDue#</td>
    <TD align="CENTER" valign="CENTER" class="table">#Completed#</td>
    </TR>
    </cfif>
    </CFOUTPUT>
    </table>

    lusciousmango Guest

  2. Similar Questions and Discussions

    1. Tracking what has been requested
      Hi I have created a php mysql web site where I am streaming videos, the user selects a video from a list then it displays on my detail page. I have...
    2. semicolon requested
      Can someone help me on this. I'm trying to insert data into 2 tables using cf defined statements from the insert form wizard. When I run the code in...
    3. Requested resource in use
      Win2K latest service packs IIS 5.0 Connecting to an Access DB *2003)- simple userlogin page, checks userpass & ID I'm all of a sudden getting the...
    4. Help Requested: Mac fh9 file to PC fh9+
      Hi there, A friend used his Mac (0n system 9) to produce a file that I have burned to a CD. I specifically downloaded the latest trial of FH11...
    5. recreating a crosstab query - explanation of an example requested
      Try this correlated subquery: Select distinct status, 10=(Select Count(MovementNo) from BigTable where size=10 AND status=Big.status),...
  3. #2

    Default Re: Query help requested

    Look into the group attribute of cfoutput

    <CFOUTPUT QUERY="ProductQ" group="Product">
    <cfoutput group="Indent">
    </cfoutput>
    </cfoutput>

    Ken
    The ScareCrow 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