fail package if the value is above or below 5% of another value

  • I use the following logic to make my package fail or succeed:

    Dim YesterdaysCount As Integer

    Dim TodaysCount As Integer

    YesterdaysCount = CInt(Dts.Variables("varEmpDataYesterdayCount").Value)

    TodaysCount = CInt(Dts.Variables("varEmpTempCount").Value)

    MsgBox(Dts.Variables("varEmpTempCount").Value)

    If TodaysCount = YesterdaysCount

    Dts.TaskResult = Dts.Results.Success

    Else

    Dts.TaskResult = Dts.Results.Failure

    End If

    I would like to change the logic and would like to fail the task if

    1) TodaysCount > YesterdaysCount + 5% of YesterdaysCount

    OR

    2) TodaysCount < YesterdaysCount -5% of YesterdaysCount

    basically all I saying is fail the task if today's count is <95% of yesterdays count or 105% greater than yesterday's count. can someone provide me exact syntax... thanks

  • If TodaysCount Cint((YesterdaysCount) * 1.05) Then

    Success

    Else

    Failure

    EndIf

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply