Thanks for your help on this one Jason.
I now have a very long calculation to deal with all of the potential options, but it works extremely well.
To tie it all up I have one further question.
The above calculation works by using the sessionid of the user, in order to determine their discount entitlement
My scenario is that many customers will be part way through their shopping process, when they realise they haven't yet logged in, and therefore not getting the discounts to which they are entitled.
Can you think of a way of updating the cart array 'after the fact' ?
The first part of the calculation is as follows, (there are 36 Discount groups, but the structure is the same throughout)...
((abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountAMin] && [Quantity] <= [DiscountAMax]))* [DiscountBandA]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountBMin] && [Quantity] <= [DiscountBMax]))* [DiscountBandB]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountCMin] && [Quantity] <= [DiscountCMax]))* [DiscountBandC]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountDMin] && [Quantity] <= [DiscountDMax]))* [DiscountBandD]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountEMin] && [Quantity] <= [DiscountEMax]))* [DiscountBandE]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountFMin] && [Quantity] <= [DiscountFMax]))* [DiscountBandF]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountGMin] && [Quantity] <= [DiscountGMax]))* [DiscountBandG]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountHMin] && [Quantity] <= [DiscountHMax]))* [DiscountBandH]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountIMin] && [Quantity] <= [DiscountIMax]))* [DiscountBandI]) + (abs([DiscountGroup] == 'A' && ([Quantity] >= [DiscountJMin] && [Quantity] <= [DiscountJMax]))* [DiscountBandJ])....) * [Quantity]