A Morse equation in Conley's index theory for semiflows on metric spaces