Same code return different results

SOLVED

When calling a Subprog from a button action on a Window, it executes a number of data validations, one of these validations does select in in SQL. 

When I execute the query in SQL, it returns the correct results. For example:

When testing the same query in 4GL directly, it returned the same results in the infobox 3 times

Calling the code from the button returns where it is used from the client side however returns this 3 times and ends.

It is the exact same code executed from 2 different places. Is there any reason this would happen? 

The only reason I could think of was that when using a Gosub to call this would result in a different behavior typeset, but at this stage I am not sure?