Cfoutput query group

I have a query that returns data displayed in table that
looks like this :
Name ID Company count
Joe Smith xx1xx Burger Inc 1
Joe Smith xx1xx McDonalds 5
Bob Jones AA2AA Jets Inc 4
What I would like it to look like is this, display the name
and ID only once :
Name ID Company count
Joe Smith xx1xx Burger Inc. 1
McDonalds 5
Bob Jones AA22A Jets Inc 4
This is the code that I am attempting to use, but it
obviously is incorrect.
<cfoutput query="qryGet_Null" group="buyer_number">
<tr>
<cfoutput>
<td>#buyer_name#</td>
<td>#buyer_number#</td>
</cfoutput>
<td>#supplier_name#</td>
<td align="center">#total_count#</td>
</tr>
</cfoutput>
Where do I have to place the cfoutput tags to make the output
displayed like the sample above ?
Also, if I export to excel, will it export just the way it
is, with one name only, per supplier ?
Thanks

Actually, trojnfn's nesting of <cfoutput> was just
fine, since the outer <cfoutput> tag was using the group=""
attribute.
When using the group attribute, you have to remember that
everything inside the outer <Cfoutput> block will only loop
once per instance of the grouped field. the code inside the inner
<cfoutput> block will loop once for each record in your
query.
However, this may not be the best tool to use in this
situation, since it looks like you want multiple rows, but only
display the name on the first row for a given buyer. Maybe
something like this might work better for you:
<!--- Used to store the current buyer name --->
<cfset sHoldName = "">
<cfoutput query="qryGet_Null">
<tr>
<!--- Only display the buyer name if the buyer name has
changed since the last record --->
<td><cfif buyer_name neq
sHoldName>#buyer_name#<cfelse> </cfif></td>
<!--- Only display the buyer number if the buyer name has
changed since the last record --->
<td><cfif buyer_name neq
sHoldName>#buyer_number#<cfelse> </cfif></td>
<!--- List supplier name and total_count for all rows
--->
<td>#supplier_name#</td>
<td align="center">#total_count#</td>
<tr>
<!--- Store the buyer name for comparison against the next
record --->
<cfset sHoldName = buyer_name>
<cfoutput>

Similar Messages

  • Query group in cfformgroup

    Hi,
    I can't figure out hvor to group output from a query like you
    can in the cfoutput tag with the group option.
    <cfscript>
    q1 = queryNew("id,firstname,lastname");
    queryAddRow(q1);
    querySetCell(q1, "id", "1");
    querySetCell(q1, "firstname", "Rob");
    querySetCell(q1, "lastname", "Smith");
    queryAddRow(q1);
    querySetCell(q1, "id", "2");
    querySetCell(q1, "firstname", "John");
    querySetCell(q1, "lastname", "Doe");
    queryAddRow(q1);
    querySetCell(q1, "id", "3");
    querySetCell(q1, "firstname", "Jane");
    querySetCell(q1, "lastname", "Doe");
    queryAddRow(q1);
    querySetCell(q1, "id", "4");
    querySetCell(q1, "firstname", "Erik");
    querySetCell(q1, "lastname", "Pramenter");
    queryAddRow(q1);
    querySetCell(q1, "id", "4");
    querySetCell(q1, "firstname", "Jane");
    querySetCell(q1, "lastname", "Jiggy");
    queryAddRow(q1);
    querySetCell(q1, "id", "4");
    querySetCell(q1, "firstname", "Jane");
    querySetCell(q1, "lastname", "Bush");
    </cfscript>
    From the above I would like to populate a tabnavigator using
    the id and each page populated with firstname and lastname
    inputfields.
    Can anyone please help?

    Hi ScareCrow,
    I just made a slight modification to your code by moving the
    cfoutput inside the inner most cfformgroup like this;
    <cfform format="flash">
    <cfformgroup type="tabnavigator">
    <cfoutput query="q1" group="id">
    <cfformgroup id="tab_#q1.currentrow#" type="page"
    label="Tab #q1.currentrow#">
    <cfoutput>
    <cfinput type="text" name="firstname_#q1.currentrow#"
    value="#q1.firstname#">
    <cfinput type="text" name="lastname_#q1.currentrow#"
    value="#q1.lastname#">
    </cfoutput>
    </cfformgroup>
    </cfoutput>
    </cfformgroup>
    </cfform>
    and it works like charm, thank you!
    I did fiddle around with a cfoutput inside the form before I
    had to give up and post my question here. After your post I
    realized that the name of my query "q1" was probably the reason I
    couldn't get my output loop to work, as "q1" and "ql" looks very
    similar. Lesson learned, I have now changed my query name to "qq".
    /Rune

  • Need help with outputing query group names

    I am trying to come up with a way to output group headers, then all the records under each group header etc. It would be easy, except there is a twist with what i want to do.
    Normally if I have this set of data (which I ‘borrowed’ from a site that showed the closest to what I’m looking for):
    Example Table Setup:
    TABLE [Numbers]
    (Name, NUMBER)
    Dave Bosky              843-444-4444
    Dave Bosky              843-555-5555
    Matthew Small        843-111-1111
    Matthew Small      _843-222-2222
    Matthew Small        843-333-3333
    I could use the following code:
    <cfoutput query="somequery" group="name">
            #name#<br>
            <cfoutput>
                    #phonenumber#<br>
            </cfoutput>
            <hr>
    </cfoutput>
    And get this:
    Dave Bosky
    843-444-4444
    843-555-5555
    Matthew Small
    843-111-1111
    843-222-2222
    843-333-3333
    BUT, my actual tables are not set up like this. Rather than recording each name with each record, I would have an ID that is the foreign key for another table.
    Current table set up would look like this:
    TABLE [People]
    (ID, NAME)
    1 Dave Bosky        
    2 Matthew Small  
    TABLE [Phones]
    (PEOPLE_ID, NUMBER)
    1              843-444-4444
    1              843-555-5555
    2              843-111-1111
    2              843-222-2222
    2              843-333-3333
    So this output would actually give me this with my current setup and the query code above:
    1
    843-444-4444
    843-555-5555
    2
    843-111-1111
    843-222-2222
    843-333-3333
    How do I keep my current setup but create a query that achieves the same result from the top? (Output the names from the People table as the group headers, but the data from the Phones table underneath that)

    Thanks! With a little tweaking I got it done.
    In case this might be useful to someone else this is the code I ended up using as a test run for what Im trying to do:
    <cfquery name="testthis" datasource="IRLE">
    SELECT ACCOUNTTYPES.ACCOUNTTYPEID, ACCOUNTTYPES.TYPEDESCRIPTION, ACCOUNTS.ACCOUNTNUMBER, ACCOUNTS.ACCOUNTTYPE, ACCOUNTS.ACCOUNTDESCRIPTION
    FROM ACCOUNTS INNER JOIN ACCOUNTTYPES ON ACCOUNTTYPES.ACCOUNTTYPEID = ACCOUNTS.ACCOUNTTYPE
    WHERE ACCOUNTUSERID = '#Session.UserID#'
    </cfquery>
    <table>
    <th colspan="3" align="center"><u>ACCOUNTS:</u></th>
    <cfoutput query="testthis" group="TYPEDESCRIPTION">
    <tr><td></td>
    <td colspan="2">#TYPEDESCRIPTION# Accounts:<BR></td>
    </tr>
    <cfoutput>
    <tr>
    <td></td>
    <td>#ACCOUNTNUMBER#</td>
    <td>#ACCOUNTDESCRIPTION#</td>
    </td>
    </tr>
    </cfoutput>
    </cfoutput>
    </table>
    Im using MySQL, so all the table names etc have to be capitalized.
    Table setup:
    ACCOUNTTYPES
    ACCOUNTTYPEID
    TYPEDESCRIPTION
    1
    CASH
    2
    TRADE
    ACCOUNTS
    ACCOUNTNUMBER
    ACCOUNTUSERID
    ACCOUNTTYPE
    ACCOUNTDESCRIPTION
    1
    1
    1
    CASH
    2
    1
    2
    BROKERAGE
    Note I also threw in a WHERE clause to only show accounts for the logged in user. (Session.USERID is defined by my code at login)
    All in all the output was:
    ACCOUNTS:
                    CASH Accounts:
                    1              CASH
                    TRADE Accounts:
                    2              BROKERAGE
    Given my data at the moment, that’s what I wanted! Sweet!

  • How to generate unique table row id's in a cfoutput query?

    I am trying to implement a jQuery drag and drop table row function to my CF pages but in order to save my "drop" positioning to the database I need to serialize all the table row id's.What coding would I need to add so that after the cfoutput query is run, each table row would have a unique id (ie. tr id="1", tr id="2", etc.)? Thanks.

    Utilize the CurrentRow variable that's automatically available within your query output:
    <cfoutput query="myQry">
              <tr id="row#currentRow#">
                        <td>...</td>
              </tr>
    </cfoutput>
    that will give you:
    <tr id="row1">
              <td>...</td>
    </tr>
    <tr id="row2">
              <td>...</td>
    </tr>
    <tr id="row3">
              <td>...</td>
    </tr>
    etc...

  • Multi-query group above report creates more pages

    Hi,
    I have a multi-query group above report (paper only), the parent group creates 5 rows(subframes) all onto the same page, but then creates 4 more IDENTICAL pages!!?
    at the end I have 5 repating frames and 5 pages.
    If I set Maximum Records per Page to 1, I have 5 pages (IDENTICAL) with the first frame only...
    any idea?
    cheers
    Matteo

    hello,
    you will have to create a counter, that tells you the numbers of students (summary-column, function : count, reset on : course) and create a format-trigger on the heading that hides it when the number of students is 0.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • The query column CANDIDATE ID appears in cfdump but not cfoutput query=queryname

    I've done this a thousand times.  I have a stored proc that returns data.  I give the resultset a name.  I output it with cfoutput query =queryname.  Now it's failing for every column in the query.  But if I do a cfdump with the queryname as a var, I get the data -- with the exact column names in my cfoutput.
    CF9, SQL Server.

    To debug, you could attempt to dump the result-set with cfoutput, as follows:
    <cfoutput query="queryName">
        <cfloop list="#queryName.ColumnList#" index="column">
            #queryName[column][currentRow]#
        </cfloop>
        <br>
    </cfoutput>
    Otherwise, could you show us your code? Many more eyes may spot something you overlook.

  • Query Group in Query Category different with Authorization's group number

    Hi All,
    In Authorization screen, it allowed to authorize up to 20 query group
    Whereas in Query Category window, it has only max 15 query group.
    Anyone has idea on why is the difference?
    Thanks in advance,
    MH

    You have a very good point.  I believe something must be for system to use during development.  You may post a development request to see if the next version could have matched numbers of query groups.  The forum is on this link:
    /community [original link is broken]
    Thanks,
    Gordon
    Edited by: Paulo Calado on Jun 19, 2009 3:33 PM

  • Query Group and Authorization group is different

    Hi,
    In Authorization screen, it allowed to authorize up to 20 query group. Whereas in Query Category window, it has only max 15 query group. For future patch, is it possible to have matched query groups?
    Thanks.
    Regards,
    MH

    Hi,
    In Authorization screen, it allowed to authorize up to 20 query group. Whereas in Query Category window, it has only max 15 query group. For future patch, is it possible to have matched query groups?
    Thanks.
    Regards,
    MH

  • Cfoutput query and form field names

    I have a form that have two field inputs. I would like to repeat the form fields as part of a cfoutput query. The first field of the form automatically populates the different person's name (via cfoutput query) and this form field is called "tenant". The next field of the form is called "sales". The sales field is left open for user imput. The entire form is in between the cfoutput query tags. When the cfoutput query is executed, Both form fields of the form is displayed with each tenant name listed in each of the first form fields of each row. The problem I'm running into is that even though the form elements appear to display correctly, I would like the name of each of my form elements in the cfoutput query, of each row to have a different form field name like, tenant2, sales2, tenant3, sales3 etc. is that possible?
    Here's what my code look like.
    <cfform action= "addsales.cfm" method="post">
    <cfoutput query="tenantsales"><Input name="tenant" type="text" value="#office.tenant#" size="32" />
    <select name="sales"><option>$5</option><option>$10</option><option>$12</option></br></cfoutput>
    <input name="submit" type="submit" />
    </cfform>

    I cannot imagine why you would want to show a list of pre-populated input fields. What makes sense to me is a select-box. If that is indeed what you want, then you could do something like this:
    <cfform action= "addsales.cfm" method="post">
    <cfselect name="tenant">
        <option value="">Tenant</option>
    <cfoutput query="tenantsales">
        <option value="#tenantsales.tenantID#">#tenantsales.tenantName#</option>
    </cfoutput>
    </cfselect></br>
    <cfselect name="sales">
    <option value="">Sales</option>
    <option value="5">$5</option>
    <option value="10">$10</option>
    <option value="12">$12</option>
    </cfselect></br>
    <cfinput name="submit" type="submit" value="Submit" />
    </cfform>
    Like Dan, I have assumed your database table has a column for tenant ID.

  • Linking Query group to an SAP role

    I am able to link the Query group to the role but when we test the user does not have access to it. I know this used to be a problems years ago that I thought was fixes. Any ideas on how to get this to work?

    Hi,
    Assign the required user groups to the user in Sq03. if user still getting same error even after assignments in Sq03, ask user to please change query areas as below and check.
    Sq01 --> Environment --> Query areas --> select "Stanard area (client-specific).
    Regards,
    Gowrinadh

  • Configure custom query group in navigation menu

    How do we configure custom query groups? Say for example: I have created a custom query group and added my custom query definitions to it. How do I configure this so that when I click on Contract Management Tab on the workbench, my custom query group is invoked?
    I need to configure custom query group in navigation menu. Any help would be appreciated.
    Regards,
    Bindu Sharma

    Hi Bindu,
    As per my understanding, it is standard and query group cannot be added in the navigation but you can add your quries under Agreement and Claus Library.
    Kindly refer the blog for the same: http://scn.sap.com/docs/DOC-55733
    Let me know if you need any other information.
    Thanks,
    Kushagra A

  • cfoutput query problems

    I am having a problem with formating results of a query. The
    Database is access using CFMX 7 JRUN multiserver version. The
    problem is thatf I use <cfoutput query="qmysignsret"> the
    result will not carraige return. If I just use <cfoutput>
    the text will carriage return. Here is the code:
    <cfset text3 = Replace(Replace(qmysignsret.text3,
    chr(32),' ','all'), Chr(10), '<br>',
    'All')><br>
    Text output with <cfoutput query="qmysignsret">
    The grass is really greener.
    Text output with <cfoutput>
    The grass is really
    greener.
    Any help is appreciated!
    Thanks,
    Ron

    I have tested on both mx 7 and 6.1 servers. This is not just
    with our environment. It is with a outside host that I also use.
    Here is the actual code:
    <cfinvoke component="testaccess" method="qsigninfo"
    sign_ID="659" returnvariable="qmysignsret">
    <cfset text3 = Replace(Replace(qmysignsret.text3,
    chr(32),' ','all'), Chr(10), '<br>',
    'All')><br>
    <br>
    <br>
    <strong>Text output with &ltcfoutput
    query="qmysignsret"&gt</strong><br>
    <cfoutput query="qmysignsret">#text3#</cfoutput>
    <br>
    <br>
    <br>
    Text output with &ltcfoutput&gt<br>
    <cfoutput>#text3#</cfoutput>
    Here is the cfc
    <cfcomponent>
    <cffunction access="remote" name="qsigninfo"
    output="false" returntype="query">
    <cfargument name="sign_ID" type="numeric" required="no"
    default="">
    <cfquery name="qsigninfo" datasource="acit">
    SELECT *
    FROM ez4X4_1template
    WHERE sign_ID = <cfqueryparam value="#arguments.sign_ID#"
    cfsqltype="CF_SQL_NUMERIC">
    </cfquery>
    <cfreturn qsigninfo>
    </cffunction>
    </cfcomponent>

  • Saved query groups authorization

    Dear All,
    Saved query groups - no.1 to no. 20 are available in the authorizations form.
    I see there are only 15 groups  in the query manager --> manage categories, and in the authorizations are 20. the remnants are 5. Where will the five groups to be used and be able to find ?
    I use SBO 2004A. I also see that it is happened in SBO 2005A. I have tried to find in SAP notes but I can't see.
    I appreciate your answers. TIA
    Rgds,

    Hi Steve,
    Seems that noone here on SDN knows the answer (including myself)
    I suggest that you raise that to SAP Support - to have them checking the case.
    Sorry,
    Frank

  • Easiest way to know the query group name?

    Hello All,
    This has been nagging at me for quite some time now. Would appreciate you inputs on the ways to find out the query group name for a set of queries we see on the UI.
    The obvious method is to search your query group from the list of query groups that system shows when we navigate to Setup->Queries and Reports->Query Groups. Do we have some other ways as well.
    Thanks In Advance
    Devesh

    Hi Devesh,
    If you know the query definition then the easiest way to find the query group would be to use "Search Query Groups by Queries Used" query on the Query Groups list page. This query allows you to select a query definition and returns the query group using the query.
    Or you could use "Query Group Review" query on the Query Groups list page. This returns all queries within all Query Groups. You can further refine your search by Query Name or Internal Name of the query you are interested in.
    If you want to do a general search for all buy-side list page or buy-side picker page query groups, search for <buylist> and <buypick> respectively.
    Hope this helps.
    Regards,
    Vikram

  • Reg: Query group by problem

    Hi,
    I am trying to write query for report generation.According to my client requirment I need to calculate the difference
    between two date columns for "n" number of rows and i need to find the number of rows which are smaller
    than 2 and number of rows which are greater than 2 and calculate the percentage for number of rows which are smaller than 2.
    It must grouped by a third column
    I tried like this, but it shows that date column is not a grouped .....
    But I dont want to group that date column... Plz adivce....
    SELECT table1.column2,
          table2.column3,
          COUNT(*),
         CASE
                 WHEN TO_NUMBER (table1.DTT_column3 - table1.DTT_column4) <=2
                 THEN COUNT(*)
                 ELSE NULL
            END
             AS sucess_count,
         CASE
                 WHEN TO_NUMBER (table1.DTT_column3 - table1.DTT_column4) >2
                 THEN COUNT(*)
                 ELSE NULL
            END
            AS fail_count,
         FROM
         table1,
         table2
         WHERE table1.column1 =       table2.column2
         AND table1.column4 = value1
         GROUP BY table1.column2,table2.column3;TIA,
    Message was edited by: ORCL
    ORCLDB

    May be something like this.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for HPUX: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
      1  with t
      2  as
      3  (select 1 id, to_date('01.02.2008','dd.mm.yyyy') date_1,
      4                to_date('03.02.2008','dd.mm.yyyy') date_2 from dual union all
      5   select 1,    to_date('03.02.2008','dd.mm.yyyy'),
      6                to_date('04.02.2008','dd.mm.yyyy') from dual union all
      7   select 2,    to_date('05.02.2008','dd.mm.yyyy'),
      8                to_date('06.02.2008','dd.mm.yyyy') from dual union all
      9   select 2,    to_date('01.02.2008','dd.mm.yyyy'),
    10                to_date('05.02.2008','dd.mm.yyyy') from dual
    11  )
    12  select count(case when to_number(date_2 - date_1) <= 2 then 1 end) diff_2,
    13        count(case when to_number(date_2 - date_1) > 2 then 1 end) diff_Greater_2,
    14    1 - (  count(case when to_number(date_2 - date_1) > 2 then 1 end)
    15         / count(case when to_number(date_2 - date_1) <= 2 then 1 end)
    16        ) percent
    17  from t
    18  group by rollup(id)
    19* having grouping_id(id) = 1
    SQL> /
        DIFF_2 DIFF_GREATER_2    PERCENT
             3              1 .666666667It will be always useful if you could post your full oracle version and a sample test data.
    Regards
    Raj

Maybe you are looking for