Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7514 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

This topic is 7514 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.