I need some help in fixing my routine. I am not getting the expected results.
In simple english the result I want is :
If Result is @TRUE and (CurrDate = PrevDate or MinCurrDate = MaxEndDt) and StCode in (20,29) then
I)If EntryDt is between start and enddate then count =1
2)If MaxEndDt = EndDate then Count =0
3) If EntryDate is null then count = 0
and in the end result I have to concatinate the equal flag to make sure the prev and current rows are the same.
Code: Select all
If CurrMCol = PrevMCol and CurrPCol = PrvPCol Then
Result = @TRUE
Equal = 'Y'
End
Else
Result = @FALSE
Equal = 'Y'
End
If (Result) Then
If (CurrDate = PrevDate or MinCurrDate = MaxEndDt) then
If (StCode = '20' OR StCode = '29' ) then
If ( EntryDate >= StartDate and EntryDate <= EndDate) then
Count = 1
End
End
If (StCode = '20' OR StCode = '29' ) then
If (MaxEndDt = EndDate) then
Count = 0
End
End
If ( IsNull(EntryDate) or EntryDate = '') then
Count = 0
End
End
End
Ans = Count : '|' : Equal
Do I have to convert all the dates into internal format before performing the conditions?
thanks