Aggregator and sum function
Moderators: chulett, rschirm, roy
No. DataStage doesn't care what value you ASSIGN to a variable. It only matters when you use it, the value needs to be able to cast or promote according to how you want to use it.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Premium Member
- Posts: 43
- Joined: Wed Oct 18, 2006 6:03 am
Not sure I got that. No one in my office can solve this problem. It sucks!
What is the best way to change the data type? How do I change it to char.
Thank you all for all your help, I really apprieciate it.
//Mattias
[quote="kcbland"]No. DataStage doesn't care what value you ASSIGN to a variable. It only matters when you use it, the value needs to be able to cast or promote according to how you want to use it.[/quote]
What is the best way to change the data type? How do I change it to char.
Thank you all for all your help, I really apprieciate it.
//Mattias
[quote="kcbland"]No. DataStage doesn't care what value you ASSIGN to a variable. It only matters when you use it, the value needs to be able to cast or promote according to how you want to use it.[/quote]
I thought it was already coming in as char and you wanted decimal(x,4) where x is the length.
Lets start from the begining, this is going no-where.
-Handle nulls before doing any manipulations using
-Change it to the required format before doing aggregations.
Also post your stage variables the way you have defined it, including its initial values.
Lets start from the begining, this is going no-where.
-Handle nulls before doing any manipulations using
-Change it to the required format before doing aggregations.
Code: Select all
If ISNULL(in.Col) OR Len(Trim(in.Col)) < 1 then 0.0000 else FMT(in.Col,"R4")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 43
- Joined: Wed Oct 18, 2006 6:03 am
Ok, you are right, thanks for listening to me. Here we go again:
Two feeds and one transformer and one aggregator.
Feed1:
--> all char (char comes into the job)
--> Hashed -->decimal, 4 (hased output is decimal)
--> Aggregator, sums two fields, groups on 4 (Decimal, 4 as input/output)
--> Hashed -->char (hashed output is char)
Feed2:
normal char
Transformer:
tryes to add Feed1_Field1 with Feed2_Field1
This works if done in a field, but not if I do it in the StageVar.
I have checked so there are no @NULL only 0.
Gracias,
Mat
Two feeds and one transformer and one aggregator.
Feed1:
--> all char (char comes into the job)
--> Hashed -->decimal, 4 (hased output is decimal)
--> Aggregator, sums two fields, groups on 4 (Decimal, 4 as input/output)
--> Hashed -->char (hashed output is char)
Feed2:
normal char
Transformer:
tryes to add Feed1_Field1 with Feed2_Field1
This works if done in a field, but not if I do it in the StageVar.
I have checked so there are no @NULL only 0.
Gracias,
Mat
Apply the derivation i gave you in the previous post for both Feed1_Field1 and Feed2_Field1.
Your hashed file feed will be null if the lookup is not found. In your stage variable apply the following derivation
Your hashed file feed will be null if the lookup is not found. In your stage variable apply the following derivation
Code: Select all
If reflink.NOTFOUND then 0.0000 + Feed2.Field1 else reflink.Feed1_Field1 + in.Feed2_Field1
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 43
- Joined: Wed Oct 18, 2006 6:03 am