If I'm understanding you, you'd like any ClientID that has "Connected" to be equal to 1 (for instance) and "Unreachable" to be equal to 0?
You could try something like:
index=blah "Connected" OR "Unreachable" | transaction ClientID startswith="Connected" endswith="Unreachable" | eval durationstr = tostring(duration,"duration")|eval ID=if(like(ClientID,"%Connected"),1,0)| table ClientID, durationstr, _time
... View more