# change in formula based on quantity

Hi team,

I have this "inherited" working formula:

if (isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None')
then

as you can see, the formula references the Quantity - and it also contains time.

For the Frontload example, the time it assess is 5.5 (= 5.5 minutes, see the first number in the formula)

now I am asked to change the formula so that what you see above, is only applicable if the quantity is 1.

IF there are additional quantities, then the assessment has to change the time to .5 (= 30 seconds)

example:

if isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None' and {ServiceCode.LineOfBusiness} = "Frontload" then

(if {ServiceInfo_vw_CurrentServices.Quantity} = 1 then 5.5*4.33/60*{@TruckCost}*{@servicefrequency} else
if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then ((5.5*4.33/60*{@TruckCost}*{@servicefrequency})+(.5*4.33/60*{@TruckCost}*{@servicefrequency}*({ServiceInfo_vw_CurrentServices.Quantity}-1))

BUT this formula gives me a message the ) is missing.. I have tried it all different kind of ways.. it sounds logical to me the way it is now. Can you please help?

THANKS

Sabine.

##### Add a comment
10|10000 characters needed characters exceeded

### Related questions

Posted on Oct 02, 2014 at 03:39 PM

Try something like this:

if (isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None') and {ServiceCode.LineOfBusiness} = "Frontload" then

(if {ServiceInfo_vw_CurrentServices.Quantity} = 1 then

5.5*4.33/60*{@TruckCost}*{@servicefrequency}

else

if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then

(5.5*4.33/60*{TruckCost}*{servicefrequency})+(.5*4.33/60*{TruckCost}*{servicefrequency}*({ServiceInfo_vw_CurrentServices.Quantity}-1))

I did two things here:

1. Because of the way "Or" works, I put parentheses around the Or statement - without them it will process for every record where {ServiceInfo.ThirdPartyServiceProvider} is null and only look at the {ServiceCode.LineOfBusiness} value if {ServiceInfo.ThirdPartyServiceProvider} = 'None'

2. I changed " if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then ((" to " if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then (" - taking out one of the parentheses.

-Dell

##### Add a comment
10|10000 characters needed characters exceeded
• Posted on Oct 02, 2014 at 03:26 PM

ok - I was able to fix the question with the missing ) ....but now something else seems to be entirely wrong because all my results are 0...

here is how I updated it:

if isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None' and {ServiceCode.LineOfBusiness} = "FRONTLOAD" then

(if {ServiceInfo_vw_CurrentServices.Quantity} = 1 then 5.5*4.33/60*{@TruckCost}*{@servicefrequency} else
if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then (5.5*4.33/60*{@TruckCost}*1*{@servicefrequency})+(.5*4.33/60*{@TruckCost}*{@servicefrequency}*({ServiceInfo_vw_CurrentServices.Quantity}-1)))

else

if isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None' and {ServiceCode.LineOfBusiness} = "REARLOAD" then

(if {ServiceInfo_vw_CurrentServices.Quantity} = 1 then 6*4.33/60*{@TruckCost}*{@servicefrequency} else
if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then (6*4.33/60*{@TruckCost}*{@servicefrequency})+(.5*4.33/60*{@TruckCost}*{@servicefrequency}*({ServiceInfo_vw_CurrentServices.Quantity}-1)))

else

if isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None' and {ServiceCode.LineOfBusiness} = "RECYCLING" then

(if {ServiceInfo_vw_CurrentServices.Quantity} = 1 then 6*4.33/60*{@TruckCost}*{@servicefrequency} else
if {ServiceInfo_vw_CurrentServices.Quantity} > 1 then (6*4.33/60*{@TruckCost}*{@servicefrequency})+(.5*4.33/60*{@TruckCost}*{@servicefrequency}*({ServiceInfo_vw_CurrentServices.Quantity}-1)))

##### Add a comment
10|10000 characters needed characters exceeded