Skip to Content
0
Former Member
Dec 07, 2006 at 02:13 PM

Retrieving current user to build an Alert

59 Views

Hola,

I'm trying to build an alert based on a query that depends of current user.

Suppose I have a user table with the internal code of current user (@Alertas.U_userCode) and I need a join with OUSR table and restrict to current user using the variable $[USER].

The query works perfectly if I execute it from menu tools/queries/user queries/my_query.

Ok. At this stage everything fine, but if I try to build my Alert based on this query, it doesn't work.

Anybody can help me ??

See the query below.

Thanks.

Júlio Caldas

SELECT

T1.U_Msg AS 'mensagem',

T0.Birthday AS 'Aniversário',

T0.U_NAME AS 'Nome do usuário',

T0.E_Mail AS 'E-mail'

FROM .[OUSR] T0 inner join

.[@Alertas] T1 on

T1.U_userCode = T0.INTERNAL_K

WHERE T0.INTERNAL_K = $[USER]