added function to retrieve the data back from the database to record.