Convert Int into Decimal

I am trying to update a decimal field using a formula (within a business process) which calculates two integer value fields. The result is getting displayed as either 1 or 0, so I am assuming I need to carry out some sort of (decimal) conversion. This is the query. Anyone know best way to achieve this?

(([#read 1.First item of resulting collection.Int1#]-[#read 1.First item of resulting collection.Int2#])/[#read 1.First item of resulting collection.Int1#])*100

 

Like 0

Like

5 comments

you can use Convert.ToDecimal( (([#read 1.First item of resulting collection.Int1#]-[#read 1.First item of resulting collection.Int2#])/[#read 1.First item of resulting collection.Int1#])*100 )

Julio.Falcon_Nodos,

thanks for reply. I did try that before but for some reason it keeps returning the value as 0.0 when I know the correct value is not that. Strange

have some examples? to understand

Julio.Falcon_Nodos,

I think the issue was with the number of decimal places it was creating. I have updated the field to an Int (as I would prefer that anyway). This is the calculation I am now using but it is still returning 0. 

Convert.ToInt32(RoundOff((([#Databowl Volume#]-[#Delivered Volume#])/[#Databowl Volume#])/100))

Hello,

I recommend enabling tracing for the process and running it. This will help to track the record data which is passed to the formula. Please note Convert.ToInt32 will return an integer. Julio's recommendation to use Convert.ToDecimal is a valid approach.

Show all comments