cancel
Showing results for 
Search instead for 
Did you mean: 

Rounding up values in Print Layout Designer

Former Member
0 Kudos

The customer has a database field in print layout designer and this is bringing back a value such as 0.25. They would like to create another field which shows this value rounded up to the nearest whole number, ie in the case of 0.25 they would like to see 1.

They have created a formulae field and used the round function, however this rounds the value down to the nearest whole number as per the general rounding rule i.e. round it down if it is below .5 and up to the nearest whole number when it is above .5

Is there anyway to achieve this using Print Layout Designer in SAP Business One 2007 A?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Samantha,

I'm afraid i don't have SAP B1 open, but you could try adding a formula field which is your database field + 0.5

Then you could round up the formula field from above to no decimal points?

e.g

0.25 + 0.5 = 0.75 (rounded to 1).

0.75 + 0.5 = 1.25 (rounded to 1).

Let me know if this does not work as there may be a different way of doing it.

Regards,

Adrian

Former Member
0 Kudos

Hi

Thanks for your repsonse.

This does work to an extent, however the issue occurs when 1.00 is provided in the original field. Adding 0.5 on to this value would result in 1 being rounded to 2 which is not correct.

It may be that this can be worked around by an extra funtion in the formulae, Did you have any other ideas?

Former Member
0 Kudos

Hi Samantha,

Apologies for the delay.

Yes, its possible to do this. Firstly, you will need to use the fields from my earlier post. However you will also need to add some more formula fields

The first formula field will work out what the numbers are to the right of the decimal point:

DecimalRight(Field_101)

Field_101 in your case will be the field ID for the quantity field and the field ID for the above formula field will be Field_102.

The second formula field will work out if the quantity is a whole number, here the field id will be Field_103:

Field_102==' '

The third formula field will work out if the quantity is not a whole number, here the field id will be Field_104:

Field_102!=' '

You can now use the Link To functionality to link the original quantity rounded field to Field_103 and you can link the quantity plus 0.5 rounded field to Field_104.

Kind regards,

Adrian

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

Agree with Gordon.

Former Member
0 Kudos

You may use formula only + 0.49 to avoid the 0.5 with wrong value. However, for any value in between 0.49 to 0.5 it will be wrong. Or you can try the value of 0.4999 if your decimal set up that long.

Thanks,

Gordon