Quick Search don't work for field with lookup when there is plsql function

I’ve a form, whith a field lookup, the query for the field lookup is:

SELECT contidenti, sc_concat(contnumero, contanovig)
FROM “public”.contrato
WHERE ValViewRecord (’[usr_login]’,contusuari)
ORDER BY contnumero, contanovig

But the Quick Search don’t work for this field, only works if delete the “where” condition

Thanks for your help.

Ps: The database is postgres

I don’t know much about postgres, but the where clause doesn’t look valid to me. I don’t see a logical operator in this. ValViewRecord is a stored procedure returning a value? Then you are missing a valid logical operation. But again, I don’t know postgres so …

Hi, ValViewRecord returns a boolean, i’ve the same codition in the sql the other form and works, and the exec by console works too… only in the fiel lookup “invalid” the quick search. If change the condition to “ValViewRecord (’[usr_login]’,contusuari) IS TRUE” and neither… Thanks

Even if the condition changes to “where 1=1”, or “where contidenti > 1” the problem with the quick search begins. I’m using SC7.