nonTransactionalCreation_bare

From the guide Copy your first script.

← ai2fm Guides · Download nonTransactionalCreation_bare.fmscript

Freeze Window
Enter Browse Mode [ Pause: Off ]
Set Variable [ $total[1] ; Value: 1000 ]
Set Variable [ $counter[1] ; Value: 1 ]
Go to Layout [ “myTable” (myTable) ]
Adjust Window [ Resize to Fit ]
Truncate Table [ With dialog: Off ; Table: “myTable” ]
Set Variable [ $startTime[1] ; Value: Get ( CurrentTimeUTCMilliseconds ) ]
Loop [ Flush type: Always ]
New Record/Request
Set Field [ myTable::PrimaryKey ; Get ( UUID ) ]
Set Field [ myTable::__pkMyTableID ; $counter ]
Set Field [ myTable::myField ; "auto-generated " & $counter ]
Set Variable [ $counter[1] ; Value: $counter + 1 ]
Exit Loop If [ $counter > $total ]
End Loop
Commit Records/Requests [ Skip data entry validation ; With dialog: Off ; Force Commit ]
Set Variable [ $endTime[1] ; Value: Get ( CurrentTimeUTCMilliseconds ) ]
Set Variable [ $elapsedTime[1] ; Value: ( $endTime - $startTime ) / 1000 ]
Go to Layout [ “myTableWithFields” (myTableWithFields) ]
Adjust Window [ Resize to Fit ]
Show Custom Dialog [ Title: "Success"; Message: $total & " Records Created at " & $elapsedTime & " seconds"; Default Button: "OK", Commit: "Yes" ]
Exit Script [ Result: JSONSetElement ( "{}" ; [ "success" ; 1 ; JSONNumber ] ) ]