CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Count related records in another table

Print topic Send  topic

Author Message
abo
Posted: 01/26/2004, 8:05 AM

Hi!,
I'm evaluating codecharge studio, it's a really good product. While a was trying to convert a project I wrote some time ago I got stucked trying to insert in columg grid a count value for records in another table.
I have 3 tables: users, questions, answers
I want to create a grid with the following:
Question_ID, Question_Title, Date_Received, User, N. of replies.
Everything is ok with the first 4 columns, but how can I have in the last column the total number of replies related to the Question_ID in the first column of the row?


lvalverdeb

Posts: 299
Posted: 01/26/2004, 9:22 AM

try this in the beforeshowrow event of the grid. This assumes that you'd display the result in a label names lblReplies and that you know how to insert a column and a new label.

global $yourform; // name of your form
global $DBConnection; // name of your connection
$result = CCDLookUp("count(*)", "answers", "Question_ID=".$yourform->ds->f("Question_ID"), $DBConnection);
$result = strval($result);
$yourform->lblReplies->SetValue($result);

_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
abo
Posted: 01/27/2004, 2:05 AM

Thank you!!! It is what I needed, it works perfectly.

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.

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.