Re: Access to an element of array NEW in TCL

From: darren(at)crystalballinc(dot)com
To: Josué Maldonado <josue(at)lamundial(dot)hn>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Access to an element of array NEW in TCL
Date: 2003-09-03 16:58:53
Message-ID: Pine.LNX.4.44.0309031257110.13877-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The way you have it should work i.e. if the NEW array has a field called
duser in it you will be able to access it using $NEW(duser)

Put in an elog notice and do [array names NEW] in it.
Run the function and see what variables are available to you then you
should be able to call them just like shown below

-bash-2.05b$ tclsh
% set NEW(duser) darren
darren
% set NEW(cuser) carl
carl
% foreach id [array names NEW] { puts $NEW($id) }
carl
darren
% puts $NEW(duser)
darren
% puts $NEW(cuser)
carl

HTH
Darren

On Wed, 3 Sep 2003, Josué Maldonado wrote:

> Hi list,
>
> Is there a way to access an especific element of the array NEW in an TCL
> trigger, I have a loop that goes for each field (thanks Ian & Darren)
> like this:
>
> foreach id [array names NEW] {
>
> then I can refer to an element with this (inside the loop):
> $NEW($id)
>
> I do need to make a reference to an especific column name (duser) in
> that array to get its value, I already tried $NEW(duser),
> $NEW(\'duser\') but didn't work. I'll appreciate any help from you
>
> Thanks
>
>
> Josue Maldonado
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Darren Ferguson

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-09-03 17:22:28 Re: Web page for selecting presentations
Previous Message Bruce Momjian 2003-09-03 16:56:21 Web page for selecting presentations