Gopala Krishnam Raju Ambati Posted June 18, 2024 Posted June 18, 2024 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 :(
comment Posted June 18, 2024 Posted June 18, 2024 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.
Søren Dyhr Posted June 18, 2024 Posted June 18, 2024 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
Gopala Krishnam Raju Ambati Posted June 19, 2024 Author Posted June 19, 2024 (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, 2024 by Gopala Krishnam Raju Ambati
comment Posted June 19, 2024 Posted June 19, 2024 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
Gopala Krishnam Raju Ambati Posted June 19, 2024 Author Posted June 19, 2024 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 ??
comment Posted June 19, 2024 Posted June 19, 2024 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
Gopala Krishnam Raju Ambati Posted June 19, 2024 Author Posted June 19, 2024 (edited) thanks will check Edited June 19, 2024 by Gopala Krishnam Raju Ambati
comment Posted June 19, 2024 Posted June 19, 2024 (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, 2024 by comment
Søren Dyhr Posted June 19, 2024 Posted June 19, 2024 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
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