Trying to find the lowest value entered into custom fields

Karoleigh Miller April 2, 2020

I have 3 fields that capture a number value. I would like to find the lowest value of the 3 fields (not null AND not 0).  I created a SIL script to do this - however it assumes all 3 fields have a value.  Truth is that not all fields are required so they may not have a value. Here is my script: 

number QuotationV1 = #{Quotation 1 Total Value};
number QuotationV2 = #{Quotation 2 Total Value};
number QuotationV3 = #{Quotation 3 Total Value};


if (QuotationV1 != 0 && isNotNull(QuotationV1)) {

if ((QuotationV1 < QuotationV2) && (QuotationV1 < QuotationV3)) {
#{Lowest Bid Cost number} = #{Quotation 1 Total Value};
#{Lowest Bidder} = #{Quotation 1 Vendor};
}
}
else {
if (QuotationV2 != 0 && isNotNull(QuotationV2)) {

if (QuotationV2 < QuotationV1 && QuotationV2 < QuotationV3) {
#{Lowest Bid Cost number} = #{Quotation 2 Total Value};
#{Lowest Bidder} = #{Quotation 2 Vendor};
}
}
else {
if (QuotationV3 != 0 && isNotNull(QuotationV3)) {

if (QuotationV3 < QuotationV1 && QuotationV3 < QuotationV2) {
#{Lowest Bid Cost number} = #{Quotation 3 Total Value};
#{Lowest Bidder} = #{Quotation 3 Vendor};
}
}
}
}

 

Hoping someone can see a obvious solution.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events