indy4300 Posted June 4, 2016 Posted June 4, 2016 I am stuck I need a calculation Odd number -1 if even number - 2
Wim Decorte Posted June 4, 2016 Posted June 4, 2016 let( [ _mod = mod( <your number field> ; 2 ) ]; if( _mod = 0 ; 2 ; 1 ) )
indy4300 Posted June 4, 2016 Author Posted June 4, 2016 thanks so much Sorry it did not work Example if I have the number 7 I need it to return 6 If I have the number 8 I need it to return 6
indy4300 Posted June 4, 2016 Author Posted June 4, 2016 I am not getting this to work my number field input is 7 I am getting a return of 1 I need it to be 6 ( as above )
comment Posted June 4, 2016 Posted June 4, 2016 (edited) 48 minutes ago, indy4300 said: I need a calculation Odd number -1 if even number - 2 That's not very clear, Please spend more time formulating your request, so we don't have to guess. Based on: 18 minutes ago, indy4300 said: my number field input is 7 I am getting a return of 1 I need it to be 6 ( as above ) I am guessing you want to do: Number - Choose ( Mod ( Number ; 2 ) ; 2 ; 1 ) Or, if you prefer: Number - 2 + Mod ( Number ; 2 ) Or even: 2 * Div ( Number - 1 ; 2 ) Edited June 4, 2016 by comment
indy4300 Posted June 4, 2016 Author Posted June 4, 2016 I am not sure how I can explain this any better Please explian what you are guessing at I just dont know how to explain it any better Odd number -1 if even number - 2 Calculated Input number 7 I need it to return 6 Calculated Input number 8 I need it to return 6 Number - Choose ( Mod ( Number ; 2 ) ; 2 ; 1 ) calculated field input Number is 7 - Choose ( Mod ( calculated field input Number is 7 ; 2 ) ; 2 ; 1 ) Return number is 4 Number - 2 + Mod ( Number ; 2 ) calculated field input Number is 7 - 2 + Mod ( calculated field input Number is 7 ; 2 ) Return number is 4
comment Posted June 4, 2016 Posted June 4, 2016 (edited) 46 minutes ago, indy4300 said: I am not sure how I can explain this any better That's actually very simple: (a) use full sentences; (b) explain the rule first, then give some examples. When explaining the rule, provide step-by step instructions how would one do the calculation manually. For example: if the given number is odd, subtract 2 from the given number; if it's even, subtract 1 (and then I would ask what if the given number is not an integer). 46 minutes ago, indy4300 said: Number - Choose ( Mod ( Number ; 2 ) ; 2 ; 1 ) calculated field input Number is 7 - Choose ( Mod ( calculated field input Number is 7 ; 2 ) ; 2 ; 1 ) Return number is 4 Number - 2 + Mod ( Number ; 2 ) calculated field input Number is 7 - 2 + Mod ( calculated field input Number is 7 ; 2 ) Return number is 4 When Number is 7, both: Number - Choose ( Mod ( Number ; 2 ) ; 2 ; 1 ) and: Number - 2 + Mod ( Number ; 2 ) return 6, not 4 as you claim (that is if I understand you correctly: I am not sure what exactly you mean by "calculated field input Number"). Edited June 4, 2016 by comment
Lee Smith Posted June 4, 2016 Posted June 4, 2016 comment gave the short version on how to post a good topic, Please read this for the full one Anatomy of a Good Topic BTW, the three calculations by comment provided the correct answer to your question.
indy4300 Posted June 4, 2016 Author Posted June 4, 2016 Thanks so much for your kindness and understanding I did get it to work I will provide more information in a better formatted way Thanks again I have read Anatomy of a Good Topic and bookmark it thank you
Recommended Posts
This topic is 3163 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now