Use sc_select_where(add) to filter calendar records

Hello,

I am trying to use sc_select_where(add) to filter calendar records based on the user that is logged in.

I tried the code below on onCalendarApplicationInit, onApplicationInit, onCalendarScriptInit, onScriptInit:

if([usr_login] != “john”)
{
sc_select_where(add)=“where class = ‘N’”;
}
else
{
//do nothing
}

The code is intended to show only records in which the field class is ‘N’ when the user is not john.
On the other hand, if the logged user is john, he will see records in which the field class is ‘N’ or ‘Y’.

In all events mentioned above (onCalendarApplicationInit, onApplicationInit, onCalendarScriptInit, onScriptInit), the code does not work and the records on calendar are not filtered as expected.

I can’t figure out my mistake. I appreciate for any help.

Thanks.

Daniel.

Hello,

Someone with a similar issue?

Any idea how to solve this problem?

Thanks,

Daniel.

I don’t know what your problem is, but here’s an example of how I use it!

Maybe that will help

Hello salvatore,

Thanks for your reply.

Did you use this on a calendar application? Because I tried on my calendar and it is not working.

Thanks,

Daniel.

oh, no in calendar app i don’t use this, sorry!

No te funciona porque la macro sc_select_where(add) está fuera del SCOPE de calendario:

image

Lo que yo hice fue dentro de Calendario > Formulario > SQL. Cambiar la cláusula WHERE, de la siguiente forma (Este ejemplo sólo muestra la agenda del usuario que inició sesión).

Thanks for your help.

Best wishes,

Daniel.