AnsweredAssumed Answered

Loop to insert records in a related table

Question asked by user28397 on Feb 2, 2018
Latest reply on Feb 2, 2018 by user28397

Hi

i have a layout in list mode where peoples can insert a value in a field. So there are records with value and others blank.

What I need to do is Find those records that have a value and create a new record in a related table based on foundset.

I try with a loop but it always miss 1 record. This is the code:

 

-Go to Layout (Protection)

- Perform Find (Protection::Commande = * )

- Go to First Record

- Loop

        set variable ($idProtection; value: id_protection_pk)

        set variable ($qte; value: qte)

        Go to Layout (Commande_Protection_Items)

        Set Field (Commande_Protection_Items::id_protection_fk; $idProtection)

        Set Field (Commande_Protection_Items::qte; $qte)

        Go to Layout (Protection::Commande)

        Go to Record (Next; Exit after Last)

End Loop

 

This don't work as i expect, it miss 1 or more records.

What is wrong?

Thanks

Outcomes