We help IT Professionals succeed at work.
Get Started

Round Double Type value to Two decimal place in lotuscript

Robert Treadwell
on
2,162 Views
Last Modified: 2013-12-18
How do you round 4.68079444599355E-04 to two decimal places.  Lotusscript Rounding returns 0 and Evaluate @Round return OverFlow Error.

Here is my code.

'Initialize Varibles
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim ses As New NotesSession
      Dim db As NotesDatabase
      Dim doc, pdoc As notesDocument
      
      Dim PCDayWk100 As Integer 'User Entry
      Dim NCDayWk100 As Double
      Dim NCDayWk120 As Double
      Dim Yrly100Demand As Double
      Dim SecPerHr As Integer 'Profile Retrieved
      Dim HrsPerShift As Double 'Profile Retrieved
      Dim NoOfShifts As Double 'User Entry
      Dim DayPerYr As Double 'Profile Retrieved
      Dim PCT As Double'User Entry
      Dim NoOfLines As Double 'User Entry
      
      Dim PCYrlyDemand As Double
      Dim dataEntrySum  As Double
      Dim PCYrlyDemandDivDataEntrySum  As Double
      
      'Set Variables
      Set db = ses.CurrentDatabase
      Set pdoc = db.GetProfileDocument("DBProfile")
      Set uidoc = ws.CurrentDocument
      Set doc = uidoc.Document
      
      If Not uidoc.FieldGetText("PCDayWk100") = "" Then
            PCDayWk100= uidoc.FieldGetText("PCDayWk100")
            NoOfShifts= uidoc.FieldGetText("NoOfShifts")
            Yrly100Demand = getYrlyDemandCol(db, doc.WrkCellID(0))
            PCT= uidoc.FieldGetText("PCT")
            HrsPerShift = pdoc.HrPerShift(0)
            DayPerYr = pdoc.DaysPerYear(0)
            SecPerHr = pdoc.SecPerHr(0)
            NoOfLines = doc.NoLines(0)
            'Perform Calculation
            PCYrlyDemand = PCDayWk100 * Yrly100Demand
            dataEntrySum = NoOfLines * SecPerHr * HrsPerShift * NoOfShifts * DayPerYr
            'dataEntrySumDivPCT = dataEntrySum / PCT
            PCYrlyDemandDivDataEntrySum = PCYrlyDemand / dataEntrySum
            NCDayWk100 =PCYrlyDemandDivDataEntrySum  / PCT
            newValue =  Evaluate("@Round(" & NCDayWk100 & ", 2)")
            Call uidoc.FieldSetText("NCDayWk100", Cstr(NCDayWk100))
            'Set Needed Capacity @120%
            NCDayWk120= NCDayWk100   * 1.2
            Call uidoc.FieldSetText("NCDayWk120", Cstr(NCDayWk120))
      End If
Comment
Watch Question
IT Consultancy
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE