CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Report with Group Headers

Print topic Send  topic

Author Message
CRandle
Posted: 11/20/2003, 11:03 AM

Hello,

I'm trying to display group headers on a report from a db query and using the help example in CCS 2.2 isn't working properly for me.

Here's the example using CCS help:

HTML:
<!-- BEGIN Row -->
<!-- BEGIN Label department_name -->
<tr>
<td bgcolor="#336699" colspan="3"><font color="White">{department_name}</font></td>
</tr>
<!-- END Label department_name -->
<tr>
<td class="ClearDataTD">{Label1} </td>
<td class="ClearDataTD">{emp_name} </td>
<td class="ClearDataTD">{title} </td>
</tr>
<!-- END Row -->

PHP:
function departments_BeforeShowRow() {
global $DepName;
global $departments;

if ($DepName == $departments->department_name->GetValue()) {
$departments->department_name->Visible = False;
} else {
$departments->department_name->Visible = True;
$DepName = $departments->department_name->GetValue();
}
}

---------------------------------------------------

Here's my html/code:

HTML:
<!-- BEGIN Row -->

<!-- BEGIN Label sub_header -->
<tr>
<td class="KnockoutDataGroup" colspan="2"> {Label3}</td>
</tr>
<!-- END Label sub_header -->

<tr>
<td>{Label1} </td>
<td>{Label2} </td>
</tr>
<!-- END Row -->

PHP:
global $NewGrid1;
global $LastGroup;

if ($LastGroup == $NewGrid1->Label3->GetValue()){
$NewGrid1->sub_header->Visible = False;
} else {
$NewGrid1->sub_header->Visible = True;
$LastGroup = $NewGrid1->Label3->GetValue();
}

------------------------------

I've put in debugging code to make sure it's entering the if/then statement properly and it is. My debug shows it should be setting the sub_header to visible in all the appropriate places.

However, the sub_header <tr> is never once showing up when I view the page.

I've done several forum searches on methods to do this and found only one dead link to an old example offsite. If anyone can show me where I went wrong or suggest a better alternative I'd appreciate it.

Thanks
Nicole
Posted: 11/22/2003, 5:22 AM

Hello,
You should use the same names for the label name and in the html comment tags which surround the label. In your case the correct code would be:
<!-- BEGIN Label Label3 -->
<tr>
<td class="KnockoutDataGroup" colspan="2"> {Label3}</td>
</tr>
<!-- END Label Label3 -->

The relevant PHP code is:
$NewGrid1->Label3->Visible = False;
CRandle
Posted: 11/24/2003, 8:10 AM

What a relief. Thank you.

I've been beating my head against the wall for days on this and your fix worked like a charm. When I first wrote it I thought it was coincidence that the label name was the same as the html block name and then never reconsidered it.

Thanks again.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.