Expression Editor Examples

Description

Expression

Splitting limit for gold assays, where the smaller of the buyer and seller assays in their default UOM is multiplied by 1%. This result is compared to 0.3, and the final splitting limit is the greater of the two.

Max(0.01*Min(Au (t.oz).BuyerAssay(),Au (t.oz).SellerAssay()),0.3)

Umpire assay settlement rule for a contract that stipulates that:

  • If the umpire result matches the result of either of the buyer or the seller, or is the exact mean of the exchanged result, then the umpire result is final.
  • If the umpire result is between the buyer and the seller, the buyer or seller result that is closest to the umpire result is the final result.

If(IsWithinBuyerAndSeller(), If(SettlementUmpireAssay() = SettlementBuyerAssay() or SettlementUmpireAssay() = SettlementSellerAssay() or SettlementUmpireAssay() = ((SettlementBuyerAssay() + SettlementSellerAssay())/2) , SettlementUmpireAssay(), If(Abs(SettlementUmpireAssay() - SettlementSellerAssay()) > Abs(SettlementUmpireAssay() - SettlementBuyerAssay()), SettlementBuyerAssay(), SettlementSellerAssay())) , null)

Quotation period that is first day of the second month after the latest sample date.

MonthOf(LatestSampleDate(), 2)

Reference date for estimating an invoice date (configured in Issue Date Terms) that uses the final assay agreement date if it exists; or else the estimated assay exchange completion date if it exists; or else 3 days after the later date out of the bill of lading date or the arrival date at the destination.

If(HasFinalAssayAgreementDate(), FinalAssayAgreementDate(), If(HasEstimatedAssayExchangeCompletionDate(), EstimatedAssayExchangeCompletionDate(), DayAdd(If(DateDifference(BillOfLadingDate(),DestinationArrival()) > 0, BillOfLadingDate(), DestinationArrival()), 3)))

Payment term that is 75 days after the beginning of first month after the month in which the sample is recorded for the last despatch.

DayAdd(MonthOf(SampleDateLastDespatch(), 1), 74)

Payment term that is 30 days after the actual unloading date, used where assay results are deemed rather than subject to an assay exchange.

DayAdd(ActualUnloadingDate(), 30)

Payment term that is the third day of the fourth month after arrival.

DayAdd(MonthOf(ActualUnloadingDate(), 4), 2)

Contract charge for late delivery, with a value of $40 per month. Subtracts the year of the planned despatch date from the year of the arrival date, and multiplies the result by 12. Likewise, subtracts the month of the planned despatch date from the year of the arrival date. Adds both of these results and multiplies by 40.

40 * ((Year(Date(DestinationArrival())) - Year(Date(PlannedDespatchDate()))) * 12 + Month(Date(DestinationArrival())) - Month(Date(PlannedDespatchDate())))

Contract charge for small lots, with a value of $300 if the wet mass of the lot is smaller than 1000 in the default unit of measure.

If(WetMass()<1000, 300, 0)

Contract charge to limit the total unit price of contract charges in an invoice to USD100/mt.

If(SumOfContractChargesUnitPrice("USD", "mt") > 100, 100 - SumOfContractChargesUnitPrice("USD", "mt"), 0)

Bonus for low ash, where the difference between the ash value and the minimum specification is multiplied by 0.2 if the ash value is below the minimum specification.

If(Ash (%).Value()<Ash (%).Minimum(),(Ash (%).Minimum()-Ash (%).Value())*0.2,0)

Pro-rata price adjustment, where 1 is subtracted from the ratio of the calorific value of the coal and the target CV. The result is multiplied by the current invoice unit price.

CurrentInvoiceUnitPrice()*((CV (kcal/kg).Value()/Base CV (kcal/kg).Target())-1)

Tiered pricing discount with a ceiling price at two tiers. Note: The expression starts with the largest tier. Using MINA() in the false condition of the if statement takes the smaller amount of the calculated discount or the ceiling of the tier.

IF(GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")>=300, GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")*0.7, IF(GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")>=225, MINA(GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")*0.8,210), IF(GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")>=125, MINA(GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")*0.9,180), GetPriceSeriesValue("NEWC Monthly",BillOfLadingDate(),"USD","t")-10)))