Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Negative Numbers in calculations

csb102155
Level 4
Level 4

I'm having some problems with getting calculations to show negative numbers.  I have attached a screenshot of what I'm trying to do.  I had a problem with the over/under flow which I solved with the "if" command, but Lines 27 and 28 need to show negative numbers when it calculates.   Can anyone help?

Thanks

Connie

Calculations.png

3 Replies
radzmar
Level 10
Level 10

Should it dsplay always negative results?

Then use these combined display patterns.

null{0}|zero{0}|num{'-'z,zzz,zz9.88}

To avoid a arithmetic over/underun ensure the calculation does only execute when the input values are not 0.

if (Row25.TonLifeVOC ne 0 and Row24.Match ne 0) then

     Row24.Match / Row25.TonLifeVOC

endif

csb102155
Level 4
Level 4

Hi radzmar.  In answer to your question, I need to be able to show negative and positive numbers depending on the data entered.  Right now it only shows positive numbers.  Can I still use what you recommended above or is there another way to show both positive and negative numbers in a calculation based on user input in other fields?

Thanks much for your help.

radzmar
Level 10
Level 10

Well,

a numeric field generally shows negative values, if the calculated result is less than 0.

Assuming TonLifeVOC is -2 and Match is 10, then the result is -5 and will be displayed in that way.

The devision has to contain at least one negative value to return a negative result, otherwise it's always positive.