Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Recommended Posts

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

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

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

Skærmbillede 2024-06-18 kl. 23.05.45.png

  • Like 1
Link to comment
Share on other sites

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

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

 

  • Plus1 2
Link to comment
Share on other sites

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 by comment
Link to comment
Share on other sites

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

  • Plus1 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.