Hi Guys, My understanding is that Count in SQL query returns a integer but I'm using this query in a loop where is the count is bigger than 2 skip and go to next record but it looks like it's not doing it, because I'm expecting that ^badis("retries",2,ID) will always be 2 or less but ^badis("retries",2,ID) did have 4 or 5 and I'm thinking that TryCount is actually not a number that's why Continue:TryCount>2 didn't work?    &SQL(SELECT count(*) INTO :TryCount FROM MSDS_Common.ScheduleTaskListHistory WHERE ScheduleTask=:ID)
Set:SQLCODE TryCount=0
^badis("retries",1,ID)=$G(TryCount)
Continue:TryCount>2
^badis("retries",2,ID)=$G(TryCount)
 </p>

Thanks

</body></html>