AnsweredAssumed Answered

Looping script syntax

Question asked by paulatkins on May 14, 2018
Latest reply on May 14, 2018 by paulatkins

Hi,

 

I am not new to filemaker, but I rarely go past the basics, hence why I am struggling with this looped script. Can I please have some advice on the syntax of this script?

 

What I am trying to achieve is in the hashed step descriptions.

What is troubling me is that the the loop is not ending, I feel the "Exit Loop If [ $RecordID = $CountRecords ] " is the problem.

 

Thank you for your time:

 

# Finding the records that need to trigger another record being made

Perform Find [ Restore ]

# Count the found set

Set Variable [ $$CountRecords ; Value: Get ( FoundCount ) ]

# Go to the first record in the found set

Go to Record/Request/Page [ First ]

# Set this as record no 1, as a variable "$RecordID"

Set Variable [ $RecordID ; Value: Get ( RecordNumber ) ]

# cycle through each record

Loop

# copy the data in the relevant field

Copy [ Select ; ShootTool::Sibling_Jpeg_Select ]

# make a new record

New Record/Request

# insert that copied data in the right place in this new record

Go to Field [ Select/perform ; ShootTool::Jpeg_Select1 ]

Paste [ Select ; No style ; ShootTool::Jpeg_Select1 ]

# go to the next record in the original found set

Go to Record/Request/Page [ With dialog: On ; $RecordID +1 ]

# exit the loop when the last record in the found set has had the relevant field copied into a new record

Exit Loop If [ $RecordID = $CountRecords ]

End Loop

Outcomes