on 08-12-2014 12:05 PM
Hi Experts,
Can anyone tell me how to calculate modulas of two numbers in design studio.
Eg: I want to calculate given year is a Leap year or not.
Normal logic is : ((year %4 ==0) && ((year%100!=0) || (year%400) ==0)).
Here in script it is not allowing to use % for modulas.
Please suggest me probable solution.
a % b equals: a - (n * int(a/n))
Following this logic, here a BIAL code as an alternative for mod:
year=2016;
divisor=4;
var txt = "";
txt = Convert.floatToString(year/divisor+1.1*0);
var integer = Convert.stringToInt(txt.substring(0,txt.indexOf(".")));
APPLICATION.alert(year-(divisor*(integer))+" ");
Best regards,
Victor
PS: This works well for me having the decimal separator defined as dot, you migth want to take care for commas as well in a productive environment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.