April 26, 200421 yr First time posting but long time user. I am looking to do multiple substitutions in fmp 7. I was told that it could be done but I have been unable to get it to run. My script is: Go to Record/Request/page[First] loop Set Field[completed_template; Substitute(template; "the_item_name"; item_name)] Set Field[completed_template; Substitute(template; "the_item_id"; item_id)] Set Field[completed_template; Substitute(template; "the_item_case"; item_case)] Go to Record/Request/Page[Next; Exit after last] end loop item_name, item_id, item_case, completed_template are all text fields template is text global The script runs but only substitutes every occurace of "the_item_name" for item_name in the global field and does not substitute either of the two other substitution fields. Can anyone see what the problem is? Where am I going wrong? Thanks
April 26, 200421 yr To get your script working, you need to reuse the value you modified: Go to Record/Request/page[First] loop Set Field[completed_template; Substitute(template; "the_item_name"; item_name)] Set Field[completed_template; Substitute(completed_template; "the_item_id"; item_id)] Set Field[completed_template; Substitute(completed_template; "the_item_case"; item_case)] Go to Record/Request/Page[Next; Exit after last] end loop To use the new FM7 multi-substitute feature, your script would be changed to: Go to Record/Request/page[First] loop Set Field[completed_template; Substitute(template; ["the_item_name"; item_name]; ["the_item_id"; item_id]; ["the_item_case"; item_case] )] Go to Record/Request/Page[Next; Exit after last] end loop
Create an account or sign in to comment