Page 1 of 1

Feeder Problem with Subtraction und Multiplication

Posted: Wed Jan 07, 2015 10:52 am
by Memo66
Hi everyone,

I habe a Rule where I subtract and multipy severel numbers. My Rule looks like:

It's all in one Cube (Cube1)

['dim1','dim2','dim3','dim4','dim5',dim6']=N:
DB('Cube1','dim1',!dim2,'dim3',!dim4,!dim5,'dim6','dim7','dim8',ELPAR('dim9',!dim9,index),'dim10')-(DB('Cube1', 'dim1', !dim2, 'dim3',DB('Cube2', 'Dim', 'Dim'),'dim5', !dim6, !dim7, !dim8, ELPAR('dim9',!dim9,index), 'dim10') *DB('Cube1','dim1',!dim2,'dim3',!dim4,!dim5,'dim6','dim7','dim8','dim9','dim10'))

I tried different Feeders but faild.

Does anyone has perhaps an idea oder suggestion?

Memo

Re: Feeder Problem with Subtraction und Multiplication

Posted: Wed Jan 07, 2015 12:56 pm
by ellissj3
Based on the calculation, I anticipate you would need to feed from 2 of the 3 terms:

I evaluated your rule as essentially A-(B*C)

['dim1','dim2','dim3','dim4','dim5',dim6']=N:
DB('Cube1','dim1',!dim2,'dim3',!dim4,!dim5,'dim6','dim7','dim8',ELPAR('dim9',!dim9,index),'dim10')-(DB('Cube1', 'dim1', !dim2, 'dim3',DB('Cube2', 'Dim', 'Dim'),'dim5', !dim6, !dim7, !dim8, ELPAR('dim9',!dim9,index), 'dim10') *DB('Cube1','dim1',!dim2,'dim3',!dim4,!dim5,'dim6','dim7','dim8','dim9','dim10'))
Feed Target from A and B or C.

With my recommendation above, there are others on this forum that would know how to better help you. I suggest you examine the forum guidelines for posting a request. It's difficult to provide assistance to you without more information.

Re: Feeder Problem with Subtraction und Multiplication

Posted: Wed Jan 07, 2015 1:20 pm
by Memo66
Hi,

sorry for the inconvenience, i'll take a look to the guidelines :)

I've read a lot about feeders and everywhere are examples like

['A*B']=n:['A']*['B'];
FEEDERS;
['A']=>['A*B'];

But i could not implement it to my problem.

Is ist possible to give me a example with the syntax for my problem. That would be great.

Re: Feeder Problem with Subtraction und Multiplication

Posted: Fri Jan 09, 2015 9:27 am
by TrevorGoss
Memo,

when you have a multiplication or division based rule, you only need to feed the area definition with the first part of the calculation.

For example:

Code: Select all

  
['C'] =N: (A * B); 
FEEDERS;
['C'] => (A);
  
A is the actual source of the calculation, b is just a number that calculates via the source. There are times when you would times a value from a source by 1000, for example, and there would be no point in feeding an area definiton with 1000.

For addition or subtraction you feed the area definition with both.

For example:

Code: Select all

['C'] =N: ('A + B');
FEEDERS;
['A']=> ['B'];
['A'] => ['C'];
With my recommendation above, there are others on this forum that would know how to better help you. I suggest you examine the forum guidelines for posting a request. It's difficult to provide assistance to you without more information.
Agreed, with more information, I will be able to give you a helping hand. But my demonstration of how feeders work will give you a start.

Thanks.

Re: Feeder Problem with Subtraction und Multiplication

Posted: Sun Jan 11, 2015 2:23 pm
by Michel Zijlema
TrevorGoss wrote:when you have a multiplication or division based rule, you only need to feed the area definition with the first part of the calculation.
I agree with you that you only need to feed from one of the calculation component areas, but this can either be A or B (so not necessarily the first part), where the area that best represents the distribution of the resulting area C should be chosen as the feeding area.
F.i. in a simple revenue calculation you can write the rule either as ['revenue'] = N: ['units sold'] * ['price']; or as ['revenue'] = N: ['price'] * ['units sold']; - in both cases ['units sold'] will typically be the most appropriate area to feed from.

Michel

Re: Feeder Problem with Subtraction und Multiplication

Posted: Sun Jan 11, 2015 10:29 pm
by rmackenzie
TrevorGoss wrote:

Code: Select all

  
['C'] =N: (A * B); 
FEEDERS;
['C'] => (A);
  
This should be:

Code: Select all

SKIPCHECK;
['C'] = N: ( ['A'] * ['B'] );
FEEDERS;
['A'] => ['C'];
['B'] => ['C'];
Per Michel's post, you can choose just one of A or B if it might be 0 at some point e.g. sales volume or number of customers, or something. I think you missed a typo in your code because you have C feeding A, when A should feed C.
TrevorGoss wrote: For example:

Code: Select all

['C'] =N: ('A + B');
FEEDERS;
['A']=> ['B'];
['A'] => ['C'];
This should be written:

Code: Select all

SKIPCHECK;
['C'] = N: ( ['A'] + ['B'] );
FEEDERS;
['A'] => ['C'];
['B'] => ['C'];
I think you missed a typo in your code because you have A feeding B and C, when both A and B should feed C.

Re: Feeder Problem with Subtraction und Multiplication

Posted: Mon Jan 12, 2015 8:52 am
by TrevorGoss
This should be:

Code: Select all
SKIPCHECK;
['C'] = N: ( ['A'] * ['B'] );
FEEDERS;
['A'] => ['C'];
['B'] => ['C'];
Indeed, it was just psuedo coding to illustrate the point.

This should be written:

Code: Select all
SKIPCHECK;
['C'] = N: ( ['A'] + ['B'] );
FEEDERS;
['A'] => ['C'];
['B'] => ['C'];

I think you missed a typo in your code because you have A feeding B and C, when both A and B should feed C.
Thanks, I missed that one. My overall point still stands, during multiplication and division, you only feed it with one side of the calculation. The number that is performing the division or multiplication, does not need to be declared as an area definition in a feeder.