PDA

View Full Version : Evaluation of query result



kettle_anonymous
04-15-2006, 06:33 AM
Attachment: Sans titre.JPG (http://forums.pentaho.org/archived_att/kettle/Sans titre.JPG) Hi,
How can i evaluate the result of a query like this


select count(*) nb from personne



1- I create a job with the following steps :
--> Start
--> SQL ( select count(*) nb from personne)
--> Evaluation



How can i get in the Evaluation step the result of that query ?
Depending of this result, i send a mail (for exemple).



Thanks



samatar

MattCasters
04-15-2006, 06:51 AM
Send the result of the count(*) to step "Copy Rows To Result".



In the evaluation you can reach the rows like this:



<pre>
var nr = rows[0].getInteger("nr", -1);

nr > 500
</pre>


I tried it, it actually works ;-) Never had the need for it though...


HTH,



Matt

shassan2
04-15-2006, 07:21 AM
Ah...

To be sure that i understand..

1- i have to create a Transformation with 2 steps :
- "Table input" with select count(*) from ...
- "Copy rows To result"

2 - Use in the job "Evaluation" With your piece of code.

kettle_anonymous
04-15-2006, 09:42 AM
Attachment: Sans titre.JPG (http://forums.pentaho.org/archived_att/kettle/Sans titre.JPG) It do not work !!!

MattCasters
04-15-2006, 11:08 AM
Attachment: yesitworks.PNG (http://forums.pentaho.org/archived_att/kettle/yesitworks.PNG) You mean the select count(*) doesn&#39;t work?
I can hardly believe that.
Anyway, the full job I tested with is shown in attachement.

Cheers,
Matt

kettle_anonymous
04-15-2006, 01:26 PM
Sorry..It works perfectly.. :-)
Thanks for all your efforts