Hi asking this on S123 board as there isn't a board set up for Sweet that I can find.
I am trying to set up validation for when I draw a line feature in Sweet, I can apply the following validation to the width field. The line feature is a field boundary and the width field is filled in by the surveyor in the form on sweet manually. The width must be a multiple of 50cm and between 100cm and 500cm. I have written two statements that work individually but not at the same time and need some help combining them.
// STATEMENT 1: validate width is in multiples of 0.5 - Check that numerical value is divisible by a number
var value = $feature["margin_width"];
var multipleOf = 50
if (value != null && value % multipleOf != 0 ) {
var msg = `Value ${value} is not multiple of ${multipleOf}`;
return msg;
}
return true;
// STATEMENT 2: validate width is between 1 and 5m
var Width = $feature["margin_width"];
if (Width < 0 || Width > 600) {
var msg = `Margin width ${Width} is not between 0 and 5m `;
return msg;
}
return true;