Forum Discussion
ldesfosses
Cirrus
Mar 26, 2018Access a table in the implemention
Hi,
I've a table that I don't know how to access.
It's received by the Implementation, if I print it :
puts "table $mytable"
I have this :
table {{
name lala
nodeaddr 8.5.2.1...
cjunior
Nacreous
Mar 28, 2018Hi dude,
I can't see that values represent a table structure, because I think tables have just rows and columns values.
set table {{name nodeaddr port}}
lappend table {lala 8.5.2.1 80}
lappend table {lolo 5.2.1.4 80}
foreach row $table {
puts $row
}
name nodeaddr port
lala 8.5.2.1 80
lolo 5.2.1.4 80
So I think you need a hash with named items like this way:
set hash "{name lala nodeaddr 8.5.2.1 port 80} {name lolo nodeaddr 5.2.1.4 port 80}"
foreach value $hash {
array set item $value
puts "$item(name) | $item(nodeaddr) | $item(port)"
unset item
}
lala | 8.5.2.1 | 80
lolo | 5.2.1.4 | 80
Best Regards.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects