SteveG
Posts: 56
|
| Posted: 12/19/2004, 4:30 AM |
|
I'd really like to use the Add Actions feature to lookup a total to use in a link field - and avoid coding. Right now my where clause looks like this: 'Discussion_Id ='.ToSQL($discussionid,ccsInteger) ... basically trying to count up records which match the current discussion in the row - but I get many MySQL errors like "Fatal error: Call to undefined function: tosql() in ...". I've tried &'s, +'s, .'s, ''s, "'s, {',s, $'s, ToSQL's, and seeming every freatkin combination for the last, oh, four hours. Can someone please let me know the syntax for doing this routine function is?
Thanks,
|
 |
 |
DonB
|
| Posted: 12/19/2004, 5:34 AM |
|
But what does the code in the Action routine look like?
For your requirement, can't you just use a query with GROUP BY to count the
records? That would mean no Action or any code is required at all.
Something along the lines of:
SELECT t1.*, COUNT(t2.*) FROM
table1 AS T1 LEFT JOIN table2 as t2
WHERE t1.foreignkey = t2.primarykey
GROUP BY t1.foreignkey
should incorporate the count of discussions, assuming there is a separate
table containing them ("table2"), which can even be a recursive relationship
to table1.
--
DonB
http://www.gotodon.com/ccbth
"SteveG" <SteveG@forum.codecharge> wrote in message
news:241c574654c3d0@news.codecharge.com...
> I'd really like to use the Add Actions feature to lookup a total to use in
a
> link field - and avoid coding. Right now my where clause looks like this:
> 'Discussion_Id ='.ToSQL($discussionid,ccsInteger) ... basically trying to
count
> up records which match the current discussion in the row - but I get many
MySQL
> errors like "Fatal error: Call to undefined function: tosql() in ...".
I've
> tried &'s, +'s, .'s, ''s, "'s, {',s, $'s, ToSQL's, and seeming every
freatkin
> combination for the last, oh, four hours. Can someone please let me know
the
> syntax for doing this routine function is?
>
> Thanks,
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
|