Converting a character to a decimal???

Posted by tracylee3124 on 23-Apr-2013 19:28

I am extremely new to Progress and OpenEdge, so bear with me. I may not be describing things correctly either, sorry for that. I am using OpenEdge 11.1. I am writing a procedure to build a report from an OpenEdge database. There is a field called hours which is a character field. There is a field called dec-hours which is a decimal because they are breaking the hours down into decimals so that they can be calculated easier. I need to calculate the hours they went over or under and the percent of unused hours. I have an error referring to incompatible data types, I am guessing that it has to do with that? I have been looking online and cannot seem to find what I need.

Is there something to convert a character field to a decimal? Or is there something I can try?

ttKReport.cBudgHours = time-r.hours
ttKReport.dActHours = time-r.dec-hours
ttKReport.dOverUnderHours = time-r.hours - time-r.dec-hours
ttKReport.dPercentUnused = ( (time-r.hours - time-r.dec-hours) / time-r.hours) * 100

Thank you in advance!


Tracy

All Replies

Posted by robw@hltool.com on 23-Apr-2013 21:08

ttKReport.cBudgHours = decimal(time-r.hours)

 ttKReport.dActHours = time-r.dec-hours

 ttKReport.dOverUnderHours = decimal(time-r.hours) - time-r.dec-hours

 ttKReport.dPercentUnused = ( (decimal(time-r.hours) - time-r.dec-hours) / decimal(time-r.hours)) * 100

Posted by tracylee3124 on 23-Apr-2013 22:25

Thank You so much. I will get it eventually. It is a little overwhelming looking stuff up sometimes.

Posted by tracylee3124 on 23-Apr-2013 22:27

Oh and sorry if I had known I only had one option I would have clicked correct answer. I am learning.

Posted by Thomas Mercer-Hursh on 25-Apr-2013 09:37

You might also be interested in this http://www.oehive.org/project/isNumber at some point.

This thread is closed