Search code examples
filemaker

Iterating through every record in a field and trimming white space


I'm trying to use the following script to replace each value in a field with the Trimmed version of itself. The script runs fine, but I export all records afterwards and I still see white space - am I missing something?

Go to Record/Request/Page [First]
Loop
    Exit Loop If [Let($c=$c+1;$c>Get(FoundCount))]
    Set Field [MyDataBase::MyField; Trim ( MyDataBase::MyField )]
    Commit Records/Requests [With dialog:On]
End Loop

Solution

  • Figured it out - I was missing a Go to Record/Request/Page [ Next ] inside my loop. Final working code is:

    Go to Record/Request/Page [First]
    Loop
        Exit Loop If [Let($c=$c+1;$c>Get(FoundCount))]
        Set Field [MyDataBase::MyField; Trim ( MyDataBase::MyField )]
        Commit Records/Requests [With dialog:On]
        Go to Record/Request/Page [ Next ]
    End Loop