By using PRINT, I have verifed that values are going into the variables. The variables and their values are:
@PrevailingWage 1.00 --PW. Values from 1.00 to 12.00 tested.
@StateMinimumWage 6.65 --SM
@FederalMinimumWage 5.85 --FM
User enters the PW value during data entry. sproc pulls value from MinWage table for SM and FM. In the MinWage table, I have used both State > Fed and vice versa.
For a record to be valid, the PW must be > the higher of the SM or the FM. With the above #’s, an @Message error should tell me that the PW is < than the SM. If the FM was > than SM, then the @Message should tell me that the PW < FM. Or at least <> in both situations.
This one produces a NULL in the record ID that I am trying to enter plus in @Message I get “PW Must Be >= State Minimum Wage”. No matter the value of the SM or FM, this one always bypasses the first IF stmnt and uses the second IF stmnt.
This one produces a NULL in the record ID that I am trying to enter but there is no msg in @Message.
I’m close, but not close enough.
Thanks,
Bill
@PrevailingWage 1.00 --PW. Values from 1.00 to 12.00 tested.
@StateMinimumWage 6.65 --SM
@FederalMinimumWage 5.85 --FM
User enters the PW value during data entry. sproc pulls value from MinWage table for SM and FM. In the MinWage table, I have used both State > Fed and vice versa.
For a record to be valid, the PW must be > the higher of the SM or the FM. With the above #’s, an @Message error should tell me that the PW is < than the SM. If the FM was > than SM, then the @Message should tell me that the PW < FM. Or at least <> in both situations.
This one produces a NULL in the record ID that I am trying to enter plus in @Message I get “PW Must Be >= State Minimum Wage”. No matter the value of the SM or FM, this one always bypasses the first IF stmnt and uses the second IF stmnt.
Code:
IF @StepCode = 'PR' OR @StepCode = 'TS' AND
@StateMinimumWage < @FederalMinimumWage AND
@PrevailingWage < @FederalMinimumWage
Begin
Set @Message = 'PWage Must Be >= Federal Minimum Wage'
Set @Continue = 0
end
IF @StepCode = 'PR' OR @StepCode = 'TS' AND
@StateMinimumWage >= @FederalMinimumWage AND
@PrevailingWage < @StateMinimumWage
Begin
Set @Message = 'PW Must Be >= State Minimum Wage'
Set @Continue = 0
end
This one produces a NULL in the record ID that I am trying to enter but there is no msg in @Message.
Code:
IF @StepCode = 'PR' OR @StepCode = 'TS' AND
@StateMinimumWage < @FederalMinimumWage
Begin
IF @PrevailingWage < @FederalMinimumWage
Set @Message = 'PWage Must Be >= Federal Minimum Wage'
Set @Continue = 0
end
IF @StepCode = 'PR' OR @StepCode = 'TS' AND
@StateMinimumWage >= @FederalMinimumWage
Begin
IF @PrevailingWage < @StateMinimumWage
Set @Message = 'PW Must Be >= State Minimum Wage'
Set @Continue = 0
end
I’m close, but not close enough.
Thanks,
Bill