I need write a script to insert this the letter "e" in a bunch of fields for example
The "e" will need to go in the 4th position in all the fields. I can't do a set field since there are other words in the field.
Of course you can use set Field
but you might want to use Replace field contents instead.
Left ( yourField; 3 ) & “e” & Middle ( yourField ; 4 ; 9999 )
would work with either method
In addition to Phil’s recommendation rather than use 9999 you can use Length ( yourField ) + 1 or variation Length ( yourField - 2 ), both would work
A loop and Set Field would also work. Replace Field Contents also works on the found set. You'll find many discussions on using this instead of the the looped Set Field. I tend to favor loop with Set Field if more than one field needs to be altered. But your choice to use whatever makes sense to you.
FileMaker Pro 16 Help Replace Field Contents
A handy function used with other script steps and functions:
FileMaker Pro 16 Help Replace(text;start;numberOfCharacters;replacementText)
is helpful in odd types of changes, such as you need:
Replace( "basball" ; 4 ; 0 ; "e" ) // = baseball!Replace( yourField ; 4 ; 0 ; "e" ) // "inserts" the e as the fourth character but does not actually replace any character
Replace( "basball" ; 4 ; 0 ; "e" ) // = baseball!
Replace( yourField ; 4 ; 0 ; "e" ) // "inserts" the e as the fourth character but does not actually replace any character
Retrieving data ...