Gopala Krishnam Raju Ambati Posted June 18 Share Posted June 18 i have a calculated result field named FINAL - RESULT is 1.1 desired result " i want is 1.5 with script for example using if substitue and result " for example im writing script forgive typographical errors if ( right(final;1)>1andright(final;1)<5 ; .5 ( i want .1 to be replaced by .5 ) ; final ) many times we do complex calculations sometimes small1s doesnt bright up the spark ;( may be due non stop designing my brain hung up im going wrong somewhere my medical brain couldnt find it out please help me :( Link to comment Share on other sites More sharing options...
comment Posted June 18 Share Posted June 18 I am having great difficulty understanding your question. What type of field is final? It appears to be a Number field - and in such case a numerical calculation would seem more appropriate than the text functions you are attempting to use. Also you say (I think?) that an input of 1.1 should result in 1.5. But then you have the condition of right(final;1)>1 which the value of 1.1 does not meet. A better explanation of the rule, along with a few examples, would be useful. Link to comment Share on other sites More sharing options...
Søren Dyhr Posted June 18 Share Posted June 18 3 hours ago, Gopala Krishnam Raju Ambati said: many times we do complex calculations sometimes small1s doesnt bright up the spark ;( may be due non stop designing my brain hung up Make a custom function to tailor each fraction into a desired result: Pease note that I use commas where you probably would use punctuations, for showing where the decimal part starts... --sd 1 Link to comment Share on other sites More sharing options...
Gopala Krishnam Raju Ambati Posted June 19 Author Share Posted June 19 (edited) final filed is number field i am trying to script final filed whose value is 1.2 but i want it to be 1.5 im trying to do without custom functions is it possible ?? Edited June 19 by Gopala Krishnam Raju Ambati Link to comment Share on other sites More sharing options...
Søren Dyhr Posted June 19 Share Posted June 19 I must ask, why script? It’s to me a calc? —sd Link to comment Share on other sites More sharing options...
comment Posted June 19 Share Posted June 19 29 minutes ago, Gopala Krishnam Raju Ambati said: value is 1.2 but i want it to be 1.5 That does not provide a sufficient explanation. If you're unable to formulate a clear rule, at least provide the expected output for all of these input values: 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 Link to comment Share on other sites More sharing options...
Gopala Krishnam Raju Ambati Posted June 19 Author Share Posted June 19 oops i will explain i made a calculation and final result i got is 1.2 i want a calculation step so that new filed final 2 should display as 1.5 if decimal is in between .1 to .4 hope i explained properly ?? Link to comment Share on other sites More sharing options...
comment Posted June 19 Share Posted June 19 10 minutes ago, Gopala Krishnam Raju Ambati said: hope i explained properly ?? Not really. Because we still don't know what the result should be when the decimal is below .1 or above .4. I am guessing (!) you want to do something like: Let ( [ r = Mod ( final ; 1 ) ] ; Int ( final ) + If ( 0 < r and r < 0.5 ; 0.5 ; r ) ) which would give the following results in my example: 1.0 ==> 1.0 1.1 ==> 1.5 1.2 ==> 1.5 1.3 ==> 1.5 1.4 ==> 1.5 1.5 ==> 1.5 1.6 ==> 1.6 1.7 ==> 1.7 1.8 ==> 1.8 1.9 ==> 1.9 2.0 ==> 2.0 2 Link to comment Share on other sites More sharing options...
Gopala Krishnam Raju Ambati Posted June 19 Author Share Posted June 19 (edited) thanks will check Edited June 19 by Gopala Krishnam Raju Ambati Link to comment Share on other sites More sharing options...
comment Posted June 19 Share Posted June 19 (edited) 24 minutes ago, Gopala Krishnam Raju Ambati said: as im from science background as math's doesn't easily penetrates my brain Isn't math the language of science? Anyway, 0 < r means that r (the decimal part) is greater than 0. Edited June 19 by comment Link to comment Share on other sites More sharing options...
Søren Dyhr Posted June 19 Share Posted June 19 15 hours ago, comment said: Not really. Because we still don't know what the result should be when the decimal is below .1 or above .4. I am guessing (!) you want to do something like: Let ( [ r = Mod ( final ; 1 ) ] ; Int ( final ) + If ( 0 < r and r < 0.5 ; 0.5 ; r ) ) which would give the following results in my example: 1.0 ==> 1.0 1.1 ==> 1.5 1.2 ==> 1.5 1.3 ==> 1.5 1.4 ==> 1.5 1.5 ==> 1.5 1.6 ==> 1.6 1.7 ==> 1.7 1.8 ==> 1.8 1.9 ==> 1.9 2.0 ==> 2.0 Could also be written this way: Let( tt = final ; Choose( Min( Mod( tt; 1 ) * 10; 5 ); tt & ",0"; Int(tt) + 0,5;Int(tt) + 0,5;Int(tt) + 0,5;Int(tt) + 0,5; tt ) ) (if being outside europe substitute commas with punctuations...) --sd 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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