How to bind a function used in a filter

I made a function which is simply returning 1 or 0

Prototype: myTest(),Byte

If I want to use it in a filter expression like: db:date<today() and myTest()=1 …

I need to bind myTest(), but when I do this (via bind fields and procedures) I get a compiler Error: Illegal return type or attribute

The error line is the bind statement: BIND(‘MyTest’,MyTest)

What I´m doing wrong?

Try

myTest(),LONG

You can only return STRING, REAL, or LONG in a binded procedure. There’s more about that in the help under BIND

1 Like

You may use variable instead as your filter so binding the procedure is not needed.
Something like this :point_down:
YourStringFilterVarialble = ‘db:date < ’ & TODAY() & ’ AND ’ & myTest() & ’ = 1’
BRWn.SetFilter(YourStringFilterVarialble)
BRWn.ApplyFilter
It will give you the same result

That’s fine if the function is only ever going to return one thing. I doubt that’s the case here.

1 Like

Yes. I just shared another route on the road.

Hi Jeff,

thank you very much👍, that was the reason.

After changing the prototype to LONG it worked✅