Page 1 of 1

How do I write Feeders about "IF" condition for consolidation

Posted: Tue Oct 06, 2015 2:15 am
by kidyee
Hi All,
I'm Korea language user. so, my English is not good. understand me.

Let's get start! My situation.

first. when I did n't use "SKIPCHECK" and "FEEDERS" then ['TOT_Origin_Agent', 'Ratio(rest)'] cell was well showen consolidation calculation below First Red box of picture.
Image

But. when I used "SKIPCHECK" and "FEEDERS" then ['TOT_Origin_Agent', 'Ratio(rest)'] cell was not showen consolidation calculation below second Red box of picture.

Code: Select all

SKIPCHECK;
#TEU interface cube로 부터 Origin Agetn TEU 값을 가져옴
['TEU'] = DB('int_data', !Year, !Months, !Origin Agent, 'TOT_Destination_Agent', 'TOT_Container_Size', 'TOT_Container_Type', 'TEU');
['Ratio'] = ['TEU'] / ['TOT_Origin_Agent', 'TEU'];

#### Question coding #####
['Ratio(rest)'] = N:if( ['Ratio(aj)'] <> 0 , 0, ['Ratio']);

FEEDERS;
['TEU'] => ['Ratio'];

#### Questino coding ####
['Ratio(aj)'] => ['Ratio(rest)'];
Image

Anyone ansewer me. thank you.

Re: How do I write Feeders about "IF" condition for consolidation

Posted: Tue Oct 06, 2015 7:47 am
by Wim Gielis
From what I read above, I would test this conditional feeder:

Code: Select all

FEEDERS;
['TEU(aj)'] => DB( IF( [Ratio(aj)']=0, 'int_data', ''), !Year, !Months, !Origin Agent, !Destination_Agent, !Container_Size, !Container_Type, 'Ratio(rest)');
Dimension names are a guess because I cannot know them.

Also, remove the 2 feeders you have now.

Re: How do I write Feeders about "IF" condition for consolidation

Posted: Tue Oct 06, 2015 8:35 am
by David Usherwood
Seems to me that since Ratio is a divide, you should use \ not / (to avoid zero errors).
For the feeder, you don't really need to conditionalise at all.
I think that you may also need to rethink the logic around ratio, ratio aj and ratio rest, but I'm not clear what you are trying to achieve so I'll leave that as a query.
So:
#TEU interface cube로 부터 Origin Agetn TEU 값을 가져옴
['TEU'] = DB('int_data', !Year, !Months, !Origin Agent, 'TOT_Destination_Agent', 'TOT_Container_Size', 'TOT_Container_Type', 'TEU');
['Ratio'] = ['TEU'] \ ['TOT_Origin_Agent', 'TEU'];

#### Question coding #####
['Ratio(rest)'] = N:if( ['Ratio(aj)'] <> 0 , 0, ['Ratio']);


FEEDERS;
['TEU'] => ['Ratio'],['Ratio(rest)'];
# keep this for your 'overrides'
['Ratio(aj)'] => ['Ratio(rest)'];