Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get rid of Curly braces

30 views
Skip to first unread message

sarayu balu

unread,
Sep 6, 1996, 3:00:00 AM9/6/96
to

I have a situation where I do a '[selection get]' in a list-box
and send a sql-query - "select .......... where name = '$payer' "
$payer is gotten from the selection. On tcl7.3, I seem to be
getting the $payer instance surrounde by { }, like {MIKE GAGNON}.
I tried everything to get rid of the braces and am not able to
do it. All I want is 'MIKE GAGNON' and not '{MIKE GAGNON}'.
Everything works OK in tcl7.4 and I cannot update tcl7.3 to 7.4.
What do I do ?
Thanks for any suggestions.
-SBalu

--
Dr.Sarayu Balu,M.D.,FAAP Tel.(802)888-2448
Ryder Brook Pediatrics,
P.O.Box 608, Morrisville, VT 05661.

Tim Edwards

unread,
Sep 6, 1996, 3:00:00 AM9/6/96
to sarayu balu

sarayu balu wrote:
>
> I have a situation where I do a '[selection get]' in a list-box
> and send a sql-query - "select .......... where name = '$payer' "
> $payer is gotten from the selection. On tcl7.3, I seem to be
> getting the $payer instance surrounde by { }, like {MIKE GAGNON}.
> I tried everything to get rid of the braces and am not able to
> do it. All I want is 'MIKE GAGNON' and not '{MIKE GAGNON}'.
> Everything works OK in tcl7.4 and I cannot update tcl7.3 to 7.4.
> What do I do ?
> Thanks for any suggestions.
> -SBalu

An easy way would be to use the command

regexp {^\{?([^\}]*)\}?$} $payer all payer

To extract the enclosed string. Note that it's safe even if the {}'s
aren't there.

This does nothing to address the fundamental difference you found, it
just patches the problem for you.

_Tim

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tim J. Edwards Motorola, Inc.
ph: (512)794-4343, fax: 4793 5918 W. Courtyard Dr., Suite 330
edw...@adttx.sps.mot.com Austin, TX 78730 USA
pager: 5165399.skytel@pagegate Internal Mail: TX73-F30B
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sarayu balu

unread,
Sep 6, 1996, 3:00:00 AM9/6/96
to

I have managed to get rid of the curly braces by,
[string trim $payer \{\}]. Still, I am not comfortable
with my understanding and where I got 'em from.

sarayu balu (sb...@nyx.cs.du.edu) wrote:
: I have a situation where I do a '[selection get]' in a list-box
: and send a sql-query - "select .......... where name = '$payer' "
: $payer is gotten from the selection. On tcl7.3, I seem to be
: getting the $payer instance surrounde by { }, like {MIKE GAGNON}.
: I tried everything to get rid of the braces and am not able to
: do it. All I want is 'MIKE GAGNON' and not '{MIKE GAGNON}'.
: Everything works OK in tcl7.4 and I cannot update tcl7.3 to 7.4.
: What do I do ?
: Thanks for any suggestions.
: -SBalu

:

Krishna Kurup

unread,
Sep 9, 1996, 3:00:00 AM9/9/96
to sb...@nyx.cs.du.edu

Elements in a list is enclosed in curly brackets to distinguish them as
so. Whenever you "select" from the database the elements are
auotmatically interpreted as list elements. Before inserting them as
listbox elements you could parse each element out (using foreach) and
then do the insert (or) let them remain as such in the listbox, but when
you do [selection get], you could get the element (if there is only one,
then the first (0th) one) using the index. This would prevent the curly
brackets from showing up.

Krishna

Henning Godske

unread,
Sep 10, 1996, 3:00:00 AM9/10/96
to

sarayu balu wrote:
>
> I have a situation where I do a '[selection get]' in a list-box
> and send a sql-query - "select .......... where name = '$payer' "
> $payer is gotten from the selection. On tcl7.3, I seem to be
> getting the $payer instance surrounde by { }, like {MIKE GAGNON}.
> I tried everything to get rid of the braces and am not able to
> do it. All I want is 'MIKE GAGNON' and not '{MIKE GAGNON}'.
> Everything works OK in tcl7.4 and I cannot update tcl7.3 to 7.4.
> What do I do ?
> Thanks for any suggestions.
> -SBalu
>
> --
> Dr.Sarayu Balu,M.D.,FAAP Tel.(802)888-2448
> Ryder Brook Pediatrics,
> P.O.Box 608, Morrisville, VT 05661.

The listbox get returns a list of entries!

So use:

[lindex [$listbox get $index] 0]

To get first (and only) entry

Henning Godske
NetMan A/S Denmark

Sigismondo Boschi

unread,
Sep 12, 1996, 3:00:00 AM9/12/96
to

sarayu balu wrote:
>
> I have a situation where I do a '[selection get]' in a list-box
> and send a sql-query - "select .......... where name = '$payer' "
> $payer is gotten from the selection. On tcl7.3, I seem to be
> getting the $payer instance surrounde by { }, like {MIKE GAGNON}.
> I tried everything to get rid of the braces and am not able to
> do it. All I want is 'MIKE GAGNON' and not '{MIKE GAGNON}'.
> Everything works OK in tcl7.4 and I cannot update tcl7.3 to 7.4.
> What do I do ?

try treating the result of selection get as e list:

set $payer [lindex [selection get] 0]
or something like this.

It should work, but I don't know why it happends

bye
--
Sigismondo Boschi
net...@comune.bologna.it
PhD student at the Physical Chemistry Department
Bologna University (Italy)

0 new messages