Handle criteria encoding empty check in the function instead of the method.