Concatenating a Text in front of Individual Database Records with Tcl
Posted
by DFM
on Stack Overflow
See other posts from Stack Overflow
or by DFM
Published on 2010-04-07T14:24:44Z
Indexed on
2010/04/07
15:03 UTC
Read the original article
Hit count: 202
Hello:
In short, currently I am using the following code to pull records from multiple tables in a Sqlite Db and insert them in a single combobox ($SearchBar):
set SrchVals1 [db eval {SELECT DISTINCT Stitle From Subcontract Order By Stitle ASC}]
set SrchVals2 [db eval {...
set SrchVals3 ...
set SrchValsALL [concat $SrchVals1 $SrchVals2 $SrchVals3]
$SearchBar configure -value $SrchValsAll
For the variable "SrchVals1", I am trying to figure out a way to concatenate the text "Sub: " to each individual record in SrchVals1. For example, if SrchVals1 shows the following records in the combobox:
First Title
Second Title
Third Title
I would like to concatenate so that the records in the combobox look like this:
Sub: First Title
Sub: Second Title
Sub: Third Title
I understand that I might have to use a foreach statement; however, I am having no luck writing one that adds "Sub: " in front of each record, as opposed to one. This seems like something that should be pretty easy, but I cannot seem to figure it out.
Does anyone know how I can achieve these results?
Thank you,
DFM
© Stack Overflow or respective owner