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 |
|
|
abo
|
Posted: 01/27/2004, 2:05 AM |
|
Thank you!!! It is what I needed, it works perfectly.
|
|
|
|