I’m working on using dblookup to pull data from SQL server. I’m able to get the data fine but I’m not having any luck pulling data out of the keyed list that it’s returning. Would appreciate a little assistance/guidance in what I’m doing wrong here.
set dept [dblookup -maxrow 1 -metacolumnname clarity_dep.tbl $deptId]
The result looks like this. The test, comma I was using to see how the non-meta return value behaved since it uses comma as its delimiter; doesn’t look like it will work. The meta option looks like the _only_ solution to deal with data that might have commas in it.
{RSMETACOLUMNNAME {department_id} {department_name} {dept_abbreviation} {external_name} {phone_number} {rev_loc_id} {serv_area_id} {test}} {RSDATA {{Department ID} {Record Name} {Abbreviation} {Friendly Name} {555-555-5555} {1} {1} {test, comma}}}
Trying to access the items in the keyedlist:
puts [keylsget dept RSMETACOLUMNNAME]
Yields:
keyed list entry must be a valid, 2 element list, got “RSMETACOLUMNNAME {department_id} {department_name} {dept_abbreviation} {external_name} {phone_number} {rev_loc_id} {serv_area_id} {test}”
I suspect the problem is with me and my understanding of keyedlists in TCL. The keyed list returned from dblookup looks like it should be fine to me and looks like it should work with the keylget call, but it’s not. I’ve been reading through various TCL keyed list references on the web and I’m stumped.
Would appreciate it if anyone has any advice on what I might be doing wrong here.