• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

grouping result output with table format

Explorer ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

I'd like to print out one vendorname for several call numbers and amont paids instead of displaying duplicate vendoranme each line. When i run the code below, the table format came out wrong. I did print vendor name once, but next line of the call number should be positioned under the call number header, but it goes under the vendor name again.
anyoen can help me to correct this data display?

Expected output:
VENDOR NAME | CALL# | AMT PAID
--------------------------------------------------------------------------------------
VERIZON WIRELES | CALLNO01 | $500.00
----------------------------------------------------------------------------------------
empty space |CALLNO02 | $200 |
-------------------------------------------------------------------------------------
empty space |CALLNO03 | $50 |
------------------------------------------------------------------------------------
empty space |CALLNO04 | $10 |
------------------------------------------------------------------------------------



--------- wrong output result for code below --------------
------------------------------------------------------------------------------------------
VENDOR NAME | CALL# | AMT PAID
--------------------------------------------------------------------------------------
VERIZON WIRELES | CALLNO01 | $500.00
----------------------------------------------------------------------------------------
CALLNO02 | $200 |
-------------------------------------------------------------------------------------
CALLNO03 | $50 |
------------------------------------------------------------------------------------
CALLNO04 | $10 |
------------------------------------------------------------------------------------

-----------------code------------------------------------
<tr align="center">
<td width="3%"><b>VENDOR NAME</b></td>
<td width="15%"><b>CALL#</B></td>
<td width="21%" align="right"><b>AMT PAID</b></td>
</tr >
<cfoutput group="vendorname">
<tr align="center" valign="top">
<td align="left">#UCase(otrQry01.vendorfullname)#</td>
<cfoutput>
<td>#UCase(otrQry01.calllnumber)#</td>
<td align="right">#DollarFormat(otrQry01.amountpaid)#</td>
</tr>
</cfoutput>
</cfoutput>
TOPICS
Advanced techniques

Views

458

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Dec 20, 2006 Dec 20, 2006
k...the expected output helps.

this is kludgy...but like Dan said, I can't think of a better way right now.

Votes

Translate

Translate
Guest
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

dump your query and make sure you have a vendorfullname value.

change this line:
<td align="left">#UCase(left(otrQry01.vendorfullname, 15))#</td>

to:
<td align="left"><cfif len(trim(otrQry01.vendorname)) GT 0>#UCase(left(otrQry01.vendorfullname, 15))#<cfelse>N/A</cfif></td>

post the results back.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

For what you are trying to do, I think you have to replace the group attribute with some if/else logic. If it's a new vendor, display it, otherwise display an empty table cell. There might be a more elegant way, but I can't think what that would be.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

ah wait... i think i see. you're grouping on VendorName, so VendorName should not be within the same <cfoutput> group as the rest of the data.

try this:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

Dan, sounds great. I will try. thanks.
CJ, it displays good, but the first row also should display call number next to the vendor name. thanks for your help.
The output for your code displays as below: (The second row should go to the same line of the vendor name)

VENDOR NAME | CALL# | AMT PAID
--------------------------------------------------------------------------------------
VERIZON WIRELES | empty space
----------------------------------------------------------------------------------------
empty space | CALLNO01 | $500.00
----------------------------------------------------------------------------------------
empty space |CALLNO02 | $200 |
-------------------------------------------------------------------------------------
empty space |CALLNO03 | $50 |
------------------------------------------------------------------------------------
empty space |CALLNO04 | $10 |
------------------------------------------------------------------------------------

Expected output:
VENDOR NAME | CALL# | AMT PAID
--------------------------------------------------------------------------------------
VERIZON WIRELES | CALLNO01 | $500.00
----------------------------------------------------------------------------------------
empty space |CALLNO02 | $200 |
-------------------------------------------------------------------------------------
empty space |CALLNO03 | $50 |
------------------------------------------------------------------------------------
empty space |CALLNO04 | $10 |
------------------------------------------------------------------------------------

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

k...the expected output helps.

this is kludgy...but like Dan said, I can't think of a better way right now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Dec 20, 2006 Dec 20, 2006

Copy link to clipboard

Copied

LATEST
CJ's solution is almost the best, given that layout and discarding fancy CSS tricks.

However, this variant should be slightly more efficient...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation