AnsweredAssumed Answered

String concatenation with Insert Calculated Result Crashes

Question asked by mrwatson-gbs on Aug 9, 2018
Latest reply on Aug 14, 2018 by mrwatson-gbs

Product and version FM17, FM16, …

OS and version MacOS Sierra

Hardware iMac

Description

I am trying to concatenate strings efficiently, and have written a benchmarking file to test the speed of Insert Calculated Result compared to Set Field for string concatenation … since

 

Set Variable[ $result ; $result & $text ]

 

can get slow when the number of concatenations (and the size of the string) gets large:

 

 

To my surpise, using

 

Insert Calculated Result[ $result ; $result & $text ]

 

(i.e: targeting a variable with NO Select option to append the result) simply crashes! :-(

 

Crash report is attached, as is the benchmarking file.

 

How to replicate

1. Create a Script

# 
Set Variable [ $text ; Value: "Text to concatenate" ] 
# 
Set Variable [ $result ; Value: "" ] 
Set Variable [ $i ; Value: 1 ] 
Set Variable [ $n ; Value: 10000 ] 
Loop
     Exit Loop If [ $i > $n ] 
     # 
     # Concatenate using Insert Calculated Result, Target Variable, NO Select // Should Append text
     Insert Calculated Result [ $result ; $result & $text ] 
     # 
     Set Variable [ $i ; Value: $i+1 ] 
End Loop
# 
Exit Script [ Text Result: $result ] 

 

2. Run the Script

     -> Crash

 

Workaround

Use

 

Set Variable[ $result ; $result & $text ]

 

... but that is missing the point!

Attachments

Outcomes