I wondered if you might be able to help me figure something else out. Along
the same premise as the first email (at the end of this message)
Once someone has filled out a form and checked certain items, the items that
were checked get thrown into a 3rd table by ITEM ID.
SO when editing that form I am trying to get it where all checked items will
appear CHECKED On the form. So far I am doing this.

(this queries to pull up a SPECIFIC report)
<CFQUERY datasource="#DSN#" name="QgetSI">
SELECT *
FROM SelfInspection
WHERE SI_OPSRPT_ID = #url.SI_OPSRPT_ID#
</CFQUERY>

Then down in the output I have what Stephen showed me earlier to get the
categories and items to lay out properly:
<CFQUERY datasource="#DSN#" name="QgetCats">
 SELECT 
        SI_Categories.SI_Category_ID, 
        SI_Categories.SI_Category,
        SI_Items.SI_Item_ID,
        SI_Items.SI_Item_Name
FROM 
        SI_Categories, 
        SI_Items
WHERE 
        SI_Categories.SI_Category_ID = SI_Items.SI_Category_ID
ORDER BY SI_Categories.SI_Category_ID
</CFQUERY>

The original output for a NEW form would be:

<cfoutput QUERY="QgetCats" group="SI_Category">
#SI_Category#</b><br>

        <cfoutput>
        #SI_Item_Name#<input name="SI_Item_ID#si_Item_ID#" value="1"
type="checkbox"><BR>
        </cfoutput>
</cfoutput>

However on the edit form I want that same output as above but another query
becomes involved to see which
items were checked upon the entry form so they will be checked when someone
pulls up the EDIT form.
So a query such as the following needs to be added:
<CFQUERY datasource="#DSN#" name="QgetCheckedItems">
SELECT SI_Item_ID
FROM SI_Items2
WHERE SI_OpsRpt_ID = #url.si_opsrpt_ID#
</CFQUERY>
This query is correct when I ran it it pulled the 2 records it should have.
However in the output now I need the check box to be checked if it shows up
in that query, I tried the following but it didnt work:


<cfoutput QUERY="QgetCats" group="SI_Category">
<b>#SI_Category#</b><br>

        <cfoutput>
        #SI_Item_Name#<input name="SI_Item_ID#si_Item_ID#" value="1"
type="checkbox" <CFIF qgetcats.SI_Item_ID IS
"QgetCheckedItems.SI_Item_ID">CHECKED</CFIF>><BR>
        </cfoutput>
</cfoutput>

It throws no errors just doesn't check ANY boxes and all the queries are
definetly running correctly so its something in the
way I am doing the output. 
Any suggestions??
Kelly



> -----Original Message-----
> From: Stephen Moretti [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, August 01, 2000 11:24 AM
> To:   [EMAIL PROTECTED]
> Subject:      RE: Help with OUTPUT of some Querys
> 
> Hi Kelly,
> 
> >
> > So basically SI_Items has the category ID for each item to show what
> > category it belongs to. All Good...
> > I want the output however to look like so.
> >
> [snip]
> > I seem to be having trouble. Obviously something has to loop and
> > maybe even
> > group (ooo a rhyme)
> > because once I pull all items I have the Category ID for each but
> > need to go
> > back to the category table
> > to find out what that category actually is. Also need the categories
> > displayed BY NAME (from category table)
> > with the items for each category (item table) listed under the
> appropriate
> > Category. i am srue I am
> > missing something little. Any suggestions???
> >
> > Should I do 2 separate queries or a join? I have tried quite a few
> things
> > and can't get it to work.
> 
> 
> Looks like what you need to do is :
> 
> SELECT SI_Categories.SI_Category_ID, SI_Categories.SI_Category_Name,
> SI_Items.SI_Item_ID,
>  SI_Items.SI_Item_Name
> FROM SI_Categories, SI_Items
> WHERE SI_Categories.SI_CategoryID = SI_Items.SI_Category_ID
> ORDER BY SI_Category_Name
> 
> Then you need to do a nested CFOUTPUT using the GROUP attribute
> 
> <cfoutput QUERY="YourQuery" group="SI_Category_Name">
>       <p>#SI_Catgeory_Name#<BR>
>       <cfoutput>
>       #SI_Item_Name#
>       </cfoutput>
> </cfoutput>
> 
> This way you have one hit on the database, the database deals with the
> ordering of the data and you get your sets of categories with their items.
> 
> HTH
> 
> Regards
> 
> Stephen
> 
> 
> 
> --------------------------------------------------------------------------
> ----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to