What are you looking at the counter to do, and what relationship do you expect between button position on the grid versus the count value?  If you have a counter that produces a one-hot active low output (all other signals driven high), one could connect each output to a diode which would pull down the keypad row assigned to that count (put pull-ups on all keypad rows), as well as to the emitter of a dedicated NPN transistor whose base was connected, via resistor, to the column assumed to that count.  Tying all the emitters together and attaching a pull-up will yield a signal which goes low whenever a button is pushed which doesn't correspond to the present count.

If one's goal is e.g. to build a timer which can be pre-set for 1-9 minutes by pushing a button, one could use a 74HC17 wired as above, wired to the bit 5 of a counter which is fed by a 555 that normally ticks 64 times per minute, but can be accelerated to run many times faster.  Net circuit requirements would be about ten transistors, nine diodes, about couple dozen resistors, a few caps, the 74HC4017, a counter (a 74HC4040 would be fine), and a 555.

Keypad to set a counter
An affidavit, from what i understand, is basically a signed document given by a witness to be used as evidence in a trial, without the witness themselves needing to take a stand.

Can an affidavit be used in Beit Din? Or must witnesses take the stand in person for their testimony to count?

(In case i'm misunderstanding what exactly an affidavit is, simply treat it as a signed document by a witness with their testimony.)
