Expand my Community achievements bar.

Expression

Avatar

Level 2

I am trying to get help with an expression. I have not had any luck, and not that great at scripting. I need to be able to express my numbers in a different manner than normal expression. This is the rule I have to follow:

 

"When expressing to the nearest whole number, express to the nearest even number when the value ends in 0.5; when expressing to the nearest tenth, express to the nearest even tenth when the value ends in 0.05. This same principle applies to expressing to the nearest ten and to the nearest hundred."

The problem will look like this;

Field 1 = Starting Temperature = 87

Field 2 = Ending Temperature = 90

Ans = Average Temperate = 88

(87 + 90)/2 = 88.5, expressed to 88 following the rule provided.

I am having trouble inputting this rule into livecycle. I can provide the sheet that I am working on if that will help.

2 Replies

Avatar

Level 10

Hi,

Try this FormCalc script:

Round(Avg(Field1, Field2))

The script combines two functions.

Round() will round up to the next integer.

Avg() will return the average value of all values it's referencing.

Avatar

Level 2

Radzmar,

Thanks for the reply. I have already tried that, but it only rounds with normal expression, not the one I am trying to get. I have played around with the 'Floor' and 'Ceil' functions, but I need to find a way to get them to express correctly also.