Data on Demand Issue with UNION in information link

I'm having problem in adding union in on demand information link. It works properly if I remove the union but when added it starts to fetch all the records instead of the data for the selected marking. Database is PostgreSQL. Does anybody know what's the issue here?

Thanks in advance.

(1) Answer