Looping on Fetch existing data on add

Looping on Fetch existing data on add

If a key field value already exists in the database I want to populate my form with the existing data. The form is populated correctly but apparently the system goes into a loop. The rotating arrow next to the key field never disappears. When I type a new value in one of the fields it is immediately reset to the value from the existing record.

 

I am using the following code on user input for the key field. 



 

if (count(temple_main_input_form[Policy_Claim_Number == input.Policy_Claim_Number])  >  0)

{

    Previous_Main_record  =  temple_main_input_form  [Policy_Claim_Number == input.Policy_Claim_Number];

    input.Policy_Claim_Number = Previous_Main_record.Policy_Claim_Number;

    input.Claimant_Name = Previous_Main_record.Claimant_Name;

    input.Examiner_Name = Previous_Main_record.Examiner_Name;

    .

    .

    .

}

 

 

Thanks for your help

 

Herb Wexler