Making a negative number positive in FPL

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

didyhans
Ebase User
Posts: 3
Joined: Tue Dec 04, 2007 4:59 pm

Making a negative number positive in FPL

#1

Postby didyhans » Wed Dec 05, 2007 2:30 pm

Is there a function that will allow me to remove the minus sign from an integer in FPL? I am trying to find out the difference between two numbers and want the result to always be positive. (For example 5 -7 = 2 (not -2))
0 x

User avatar
Joost
Ebase User
Posts: 49
Joined: Fri Sep 14, 2007 6:14 pm
Location: The Netherlands

#2

Postby Joost » Thu Dec 06, 2007 9:21 am

Hmm... no function, but wouldn't the following do the trick?

set TEST = (5-7) * -1;

Where TEST is an integer field.
0 x

didyhans
Ebase User
Posts: 3
Joined: Tue Dec 04, 2007 4:59 pm

#3

Postby didyhans » Thu Dec 06, 2007 5:10 pm

Excellent, that works a treat. Two negatives make a positive!

In my script I have added a check to make sure that the number is negative before I multiply by minus one as it could sometimes be positive.

Thanks Joost.
0 x


Who is online

Users browsing this forum: No registered users and 4 guests