Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

360 Scribe - Replacing multiple fields for Word Doc

Featured Replies

I'm wondering if Scribe plugin can find and replace multiple fields and how would I write that script? I've duplicated the script from the demo, but I'm unsure how to work it to replace these different fields, such as "Company Name" "Company Address" "City" "State" "Zip" etc. Any help would be greatly appreciated :)

Edited by kims

Hi kims,

  Assuming you are using a Word document and a template with placeholders,  the short answer is you need to call ScribeDocSubstitute for every placeholder you need to replace. I'd also recommend that you make your placeholders a bit more unique like "CompanyName", "CompanyAddress" "CompanyCity" "CompanyState" etc. I'm a bit weary if you copied the demo script verbatim because they are definitely set up to work within that file so you will need make sure that you modify any field references and any control script steps like go to record, go to layout, etc when they are not necessary. I highly recommend that you write your own script and use the demo file as an example of how to use the plugin. The basic workflow for substituting text in a Word document using Scribe are as follows:

//Load the document
ScribeDocLoad(Documents::myDocument)

//Find and replace all placeholders. Call ScribeDocSubstitute for each 
ScribeDocSubstitute("CompanyName";Company::Name)
ScribeDocSubstitute("CompantAddress"; Company::Address)
etc.

//Save the document
Set Field [Documents::ScibeDocument; ScribeDocSaveContainer(newname.docx)

//Alternatively you can save the document using ScribeDocSaveFile if you would rather save the file outside of your solution
ScribeDocSaveFile(Get(DesktopPath)&newname.docx)

Hope that helps!

  • Author

Yes, I got what I needed. Guess I didn't think it through all the way before writing the post.

 

My second question... Is there any way to have Scribe delete a line from the Word Doc? For example, if there is nothing in the CompanyAddress2 field, I don't need that in the document so it needs to be deleted out.

Not explicitly. I suppose you could have an if conditional that checks to see if the corresponding FileMaker field for CompanyAddress2 is empty and if it is, write an empty string ("") to the document. This probably wont delete the line but it would clear the placeholder from the final document.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.