Hi team,
I have this "inherited" working formula:
if (isnull({ServiceInfo.ThirdPartyServiceProvider}) or {ServiceInfo.ThirdPartyServiceProvider}= 'None')
then
Select {ServiceCode.LineOfBusiness}
Case 'FRONTLOAD': 5.5*4.33/60*{@TruckCost}*{ServiceInfo_vw_CurrentServices.Quantity}*{@servicefrequency}
Case 'REARLOAD': 6*4.33/60*{@TruckCost}*{@servicefrequency}+ .5*4.33/60*{@TruckCost}*{ServiceInfo_vw_CurrentServices.Quantity}*{@servicefrequency}-.5*4.33/60*{@TruckCost}*{@servicefrequency}
Case 'RECYCLING': 6*4.33/60*{@TruckCost}*{@servicefrequency}+ .5*4.33/60*{@TruckCost}*{ServiceInfo_vw_CurrentServices.Quantity}*{@servicefrequency}-.5*4.33/60*{@TruckCost}*{@servicefrequency}
Default : 0
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.
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
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