Fetch all data for a given "Index"

Fetch all data for a given "Index"

As I enter data into a form, I need to look up all data that was previously entered into the same form.  All of the data will have a unique Index key. 
 
As I enter the additional data, I need to compare the new data being entered with past data that was entered.
 
I will need to fetch multiple field with all records previously collected for a given index key.  Once all fields for all records has been fetched, I will need to run several IF statements.
 
I know I will be using a fetch script.  I just need a sample script for this senario.
 
 
Suggestions?