Russel's loop worked as he wrote it. I tested it. ???
//var %a = 1, %b = $hget(<table>,0).item | while %a <= %b { echo -a $hget(<table>,%a).item is $hget(<table>,%a) | inc %a }
I see what you are saying about the '1' as the first item in the field for the host, which is the way a table works:
1.2.3.4 1
on a /hget for 1.2.3.4 /hget would return a 'true' thus letting the 'if' continue.