Expand my Community achievements bar.

LC Action Builder problem using less than zero

Avatar

Level 3

I am using Action Builder to build a script for a number range for Latitude and Longitude from 0-59. If less than zero or more than 59 I want it to show a message box. The problem is that if you enter zero, it shows the message box instead of letting you enter zero. Below is the code it is generating, which looks correct to me. Any ideas as to why it won't let me enter a zero? Or maybe I should just use that code in Javascript and not through the Action Builder?

Thanks in advance, Gary

 

//+ GENERATED - DO NOT EDIT (ID:5EF2CAAE-392B-4ACC-94C9-48AC34C1F8D6 CRC:441724646)

//+ Type: Action

//+ Result2: SetFocus("$Node1")

//+ Result1: ShowDialog("error","Latitude must be between 0 and 59 Minutes.","LatMin")

//+ Or: 1

//+ Node1: CircuitList[0].Forms[0].Installation_Form[0].Installation_Body[0].Latitude_Minutes[0]

//+ Condition3: NumericField("$Node1","empty","")

//+ Condition2: NumericField("$Node1","greaterThan","59")

//+ Condition1: NumericField("$Node1","lessThan","0")

//+ ActionName: Latitude Minutes 2

 

if (this.resolveNode("$").rawValue < 0 || this.resolveNode("$").rawValue > 59 || (this.resolveNode("$").rawValue == null || this.resolveNode("$").rawValue == "")) { 

xfa.host.messageBox("Latitude must be between 0 and 59 Minutes.", "LatMin", 0);

xfa.host.setFocus("$");

}

//-

1 Reply

Avatar

Level 10

Try reversing the condition. Check if the number is between 0 and 59, if it isn't then throw an error.

(pseudocode)

if (value >= 0 && value <= 59) then

   do stuff

else

   throw error

endif