473,667 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access to an element of array NEW in TCL

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

Nov 11 '05 #1
2 4300
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 YourEmailAddres sHere" to ma*******@postg resql.org)


--
Darren Ferguson
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 11 '05 #2
As long as it is an insert or update trigger that fires your tcl
function, you have access to the NEW array. The foreach loop uses the
tcl command [array names NEW] to suck out the names of the existing
members of the array. If a column called duser exists in the NEW array
(it is part of the inserted tuple, or not updated to null) you should be
able to access it as

$NEW(duser)

What error are you getting? If the duser column is null, there is no
array member called NEW(duser) and you will get an error to that effect.

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 YourEmailAddres sHere" to ma*******@postg resql.org)



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
3799
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
9
4044
by: Haobin | last post by:
Hi everyone, I have an ArrayList whose members are classes. These classes are derived from a same base class. The base class has a floating point array and a string. How do I access each element in the floating point array in a member of the ArrayList? Any help would be greatly appreciated. Haobin
2
2759
by: Trip | last post by:
Hello all, Is there anyway to store an array to MS Access 2002 without parsing the entire array row-by-row. For example, Oracle allows you to store BLOBs (binary large objects). I would like to be able to say in VB/VBA With rstName .AddNew !fieldName = ArrayName .Update
9
2190
by: gk245 | last post by:
I have something like this: struct block { int x; int y; float z; }
13
5321
by: mfreeman | last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown below. All I do is loop through the records in the table and update them without making any changes. Out of 600 records, about 40 of them throw Concurrency violation errors in the update, and my GetAllColErrs function provides no output. In comparing the rows that throw errors with those that do not, I could find no pattern. It is obviously a bogus error, as the...
6
5988
by: Urs Thuermann | last post by:
With offsetof() I can get the offset of a member in a struct. AFAICS, it is portable and clean to use this offset to access that member. I need to do something like this struct foo { struct foo *next; int a; int b; int c; };
10
1760
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, There is error message when executing my program, Unhandled exception at 0x00411a49 in test_entern.exe: 0xC0000005: Access violation reading location 0x00000002. It is very simple, does anyone know what is wrong with the program?
0
18781
NeoPa
by: NeoPa | last post by:
Many of us have noticed that there are some very useful functions available to you when using Excel, but these same functions are not available, as standard, in Access. A particular issue I had recently (and I know others have come across this recently too) is rounding up and down. I know the Excel ROUNDUP() function rounds away from zero rather than upwards specifically, but is still useful in most circumstances. To allow an Access...
1
2649
by: gihan | last post by:
Hi, I have a problem accessing remote webservice from my asp code. Instead of returning results, it returns list of web methods it has. Wonder where i'm doing wrong. Also note that, this is a ristricted webservice, which need username password to access and I can't use third party tools (llike xmlspy, webservice studio) to access it and debug. I only got is WSDL. Here is the WSDL <wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"...
0
8457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7390
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.