CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 grid form with custom slq assigned to label

Print topic Send  topic

Author Message
travel-net

Posts: 56
Posted: 03/03/2004, 6:26 AM

Hello,

I don't know how i must achieve the folliwing problem.

I wan't to add an extra label in a grid form which display's a value based on the following SQL code:

SELECT klant_tbl.klant_id, count(*),SUM(bedrag) AS totaal
FROM klant_abonn_tbl, klant_tbl, l_abonn_tbl
WHERE klant_tbl.mutatie_id <> 3
AND klant_abonn_tbl.mutatie_id <> 3
AND klant_abonn_tbl.klant_id=klant_tbl.klant_id
AND klant_abonn_tbl.abonn_id = l_abonn_tbl.abonn_id
AND klant_tbl.klant_id = klant_abonn_tbl.klant_id
GROUP BY klant_abonn_tbl.klant_id

This sql query is working.

The label should display totaal which stands for Amount in English

The grid itself has it's own sql based on the standard wizard from CCS.

Maybe there are severall ways to achieve this, but i don't now what is the best solution.

Regards,
Frans
View profile  Send private message
johny_f

Posts: 23
Posted: 03/04/2004, 3:54 AM

ADD Label before show event (not grid):

$db = new clsDBconnection-name(); // open coonection (replace "connection-name" with the real name of your connection used by CCS

$SQL = "SELECT klant_tbl.klant_id, count(*),SUM(bedrag) AS totaal
FROM klant_abonn_tbl, klant_tbl, l_abonn_tbl
WHERE klant_tbl.mutatie_id <> 3
AND klant_abonn_tbl.mutatie_id <> 3
AND klant_abonn_tbl.klant_id=klant_tbl.klant_id
AND klant_abonn_tbl.abonn_id = l_abonn_tbl.abonn_id
AND klant_tbl.klant_id = klant_abonn_tbl.klant_id
GROUP BY klant_abonn_tbl.klant_id";

// I think you shoul remove Group by to get only apropriete number for selected row

$db->query($SQL);
$xcount = $db->num_rows(); //num of rows if you wish

$Result= $db->next_record(); // get record

if ($Result)
{
$c_id = $db->f("db_fieldname"); // get certain field from DB
}
unset($db);
// set value do label
$gridname->labelname->SetValue($c_id);

I hope this is clear, I persume you want to display diff. single result for each row of the grid.

Johny_f

_________________
Johny_f
View profile  Send private message

Add new topic Subscribe to topic   


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

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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