Using keylset in TCL to return multiple values ​​to a string when parsing

I have a way out

Application
----------------------------------------
ID 5 - Value 1
ID 5 - Value 2
ID 6 -  Value 1
ID 6 - Value 2
----------------------------------------

I parse it using keylset in tcl Now I get after parsing:

ID
    5
        Value
             1 = 1
             2 = 2
    6
        Value
             1 = 1
             2 = 2

Can anyone suggest me how I can get it as follows.

  ID
    5
        Value 1,2
    6 
        Value 1,2
+3
source share
1 answer

You want to use the keylgetoptional retval argument when extracting to lappendand keylsetto return it, perhaps like this:

set seq {}
keylget data ID.$id.Value seq
lappend seq $theValue
keylset data ID.$id.Value $seq
+3
source

All Articles