Page 1 of 1

Need count of records being populated

Posted: Fri Dec 09, 2005 6:50 am
by sengs
Hi,
The job i designed generates a sequence number in the transformer stage.I want the total count of the sequence number in the target.
For example if the sequence number is from 1 to 10 then i want the count as 10 in the next stage.Help me in this regard.
Thanks,
Sengs

Re: Need count of records being populated

Posted: Fri Dec 09, 2005 7:33 am
by ravij
Hi
You can do it using Agg stage. select count option in teh group by option. U will get the total count.
JRK
sengs wrote:Hi,
The job i designed generates a sequence number in the transformer stage.I want the total count of the sequence number in the target.
For example if the sequence number is from 1 to 10 then i want the count as 10 in the next stage.Help me in this regard.
Thanks,
Sengs

Re: Need count of records being populated

Posted: Sun Dec 11, 2005 11:19 pm
by sengs
Hi ravi,
i tried using the aggregator.But it is also not giving me the total count.Instead it is giving me a sequence number like 1,2,3...10 again.
Thanks,
sengs

Posted: Sun Dec 11, 2005 11:25 pm
by Andal
Hi Sengs,

Your Question is not very clear.
If you generate the Sequence No's in a transformer, "@OUTROWNUM" will contain the count.

Re: Need count of records being populated

Posted: Sun Dec 11, 2005 11:53 pm
by loveojha2
sengs wrote:Hi ravi,
i tried using the aggregator.But it is also not giving me the total count.Instead it is giving me a sequence number like 1,2,3...10 again.
Thanks,
sengs
The input to the aggregator would be the sequence number, the ouput would be a single column with the derivation as the count().
Hi Sengs,

Your Question is not very clear.
If you generate the Sequence No's in a transformer, "@OUTROWNUM" will contain the count.
If you use @OUTROWNUM then your derivation would be max() for the @OUTROWNUM column.

Posted: Mon Dec 12, 2005 12:39 am
by jenkinsrob
The quickest way is probably to use a hashed file.

Create 2 columns. Hard-code the first column with a value such as 'X' and make this the key column in your hashed file. Set the derivation for the other column in your transformer to @OUTROWNUM.

As the rows pass through the hashed file they will be de-duped based on the hard-coded key and you will be left with a single row containing the highest value that @OUTROWNUM reached ie your rowcount

Posted: Mon Dec 12, 2005 12:41 am
by tcj
You want the max of the sequence number for each of the rows you pass through? :?

Re: Need count of records being populated

Posted: Mon Dec 12, 2005 2:52 am
by sengs
Hi Sengs,

Your Question is not very clear.
If you generate the Sequence No's in a transformer, "@OUTROWNUM" will contain the count.
If you use @OUTROWNUM then your derivation would be max() for the @OUTROWNUM column.[/quote]

Hi ravi,
i am generating the sequence number in the transformer stage by giving the derivation as @outrownum. But when i take max of @outrownum in the aggregator it still returns the value as 1,2,3,4.....N
My requirement is i want the value 'N' and i am using this value in an another sequence job.The value of 'N' will be differing every time when i run the job with certain parameter.
Thanks,
Senguttuvan

Posted: Mon Dec 12, 2005 2:54 am
by sengs
jenkinsrob wrote:The quickest way is probably to use a hashed file.

Create 2 columns. Hard-code the first column with a value such as 'X' and make this the key column in your hashed file. Set the derivation for the other column in your transformer to @OUTROWNUM.

As the rows pass through the hashed file they will be de-duped based on the hard-coded key and you will be left with a single row containing the highest value that @OUTROWNUM reached ie your rowcount
Hi ,
Can you please explain this with an example.I could not understand your statement "As the rows pass through the hashed file they will be de-duped based on the hard-coded key and you will be left with a single row containing the highest value that @OUTROWNUM reached ie your rowcount".
Thanks,
sengs

Posted: Mon Dec 12, 2005 4:25 am
by loveojha2
sengs wrote:
jenkinsrob wrote:The quickest way is probably to use a hashed file.

Create 2 columns. Hard-code the first column with a value such as 'X' and make this the key column in your hashed file. Set the derivation for the other column in your transformer to @OUTROWNUM.

As the rows pass through the hashed file they will be de-duped based on the hard-coded key and you will be left with a single row containing the highest value that @OUTROWNUM reached ie your rowcount
Hi ,
Can you please explain this with an example.I could not understand your statement "As the rows pass through the hashed file they will be de-duped based on the hard-coded key and you will be left with a single row containing the highest value that @OUTROWNUM reached ie your rowcount".
Thanks,
sengs
Since the key column is hard coded in the transformer(say with value 'X'), when first time it is written to Hashed File a row with 'X' as the primary key (and a non key column)would be created. Next time when it will again write another row with 'X' as the primary key (and other non key column)it will get overwritten (or in other word updated), since this column is the primary key.

Re: Need count of records being populated

Posted: Mon Dec 12, 2005 3:57 pm
by ray.wurlod
sengs wrote:Hi ravi,
i tried using the aggregator.But it is also not giving me the total count.Instead it is giving me a sequence number like 1,2,3...10 again.
Thanks,
sengs
You can not get the final count until the last row has been processed. Think about what happens.
Read the other suggestions (Transformer stage, Aggregator stage using Last, Aggregator stage using Count). All will work for you.