locked
Lightswitch - Issue Using Percentage Calculated Field RRS feed

  • Question

  • I have a Parent Table, which is (BusinessRequirements) and a Child Table of (Revisions), in the Entity, I have a computed field PercentageComplete defined as a Percentage, which looks at the status of each Revision, if the Status < 80 (the work has not been completed), then the estimated-hours is used for the estimated-hours and actual-hours is used for the actual-hours, if the Status >= 80 "Development Completed" then the actual-hours is used for both (in order to return 100%).

    I return the result of -  Private Sub PercentageComplete_Compute(ByRef result As System.Nullable(Of Decimal)), I have tried:

     Int(result = CInt(Int(percent)))

     result = Int(percent)

     result = CInt(Int(percent))

    However, when the Search Screen for the Business Requirements displays the Grid, I get the following validation error

    Percentage Complete (BR000002): The value 0.66666666666667 contains too many decimal places. The maximum is 9.

    Does anybody understand this behaviour??

     

    Friday, February 8, 2013 2:13 PM

Answers

  • Percentage fields are not integers but decimals, as you can see by the type definition of the result in your PercentageComplete_Compute event, so you should not be trying to truncate the result with Int() or cast it as an integer with CInt().

    100% = 1.00 and 50% = 0.5

    If you're still having problems, please reply with the whole code of the PercentageComplete_Compute event so we can advise you more.

    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Friday, February 8, 2013 3:02 PM