Well I did not get any positive answers from anyone on the list about doing
a COUNT(*) so I thought you my like to know what to do should you need to do
this.

// First we must set up the Reactor Factory.
Reactor = CreateObject("Component",
"reactor.reactorFactory").init(expandPath("reactor.xml"));

// Then we create the gateway object.
Page_Gateway = Reactor.createGateway("MyTable");

// Then we create the Query object.
Query = MyTable_Gateway.createQuery();

// Create a field to use using an exsiting column
Query.returnObjectFields("MyTable","SomeColumn");

// Set up the Count
Query.setFieldExpression("MyTable","SomeColumn","COUNT(*)","CF_SQL_INTEGER")
;

qRecordCount = MyTable_Gateway.getByQuery(Query);

Unfortunately I can yet see how to set up a GROUP BY clause so watch this
space ......

Kevin Roche

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Kevin Roche
Sent: 14 September 2006 23:25
To: [email protected]
Subject: [Reactor for CF] Aggregate Functions in Gateways


Anybody out there know how to do an Aggregate function in a Reactor Gateway?
For example I want to do somthing like...

SELECT COUNT(*) FROM myTable

It seems to me that setFieldExpression should do it but I have tried a few
things and they don't work.

For example:

Query.setFieldExpression("myTable","RC","COUNT(*)","CF_SQL_INTEGER");

doesn't produce anything in the resuling SQL. What am I doing wrong?


Kevin Roche



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
- --




-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to