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.

Button script to insert 'merge field' contents

Featured Replies

Needing help generating a script that will do the following:

 

I have a bunch of merge fields (which contain text, that the user defines in another layout) on a layout. 

 

I want to set the merge field item as a button.

 

When the user taps the button (on iPad), I want the script to insert the text of the merge field, into a "TxNotes" field.

 

Preferably, I want to have a single script that can be applied to each of the merge field buttons, inserting the merge field text of the particular button.

 

Currently, I have an individual script for each button, which inserts the contents of the associated field - however, I need a considerable number of buttons, so want to economise on script usage.

 

Current script (per button) is:

 

Insert Calculated Result [Visit Notes::TxNotes; CAA::R1C1 & " "]

Go to Object [Object Name: "AL"]

 

.......whereby the referenced field value CAA::R1C1 is different for each button. (i.e. R1C1 = row 1 column 1 of the button layout, other fields are R1C2, R1C3, R2C1 etc).

 

I'm thinking I need to set up a global variable, say $$mergefieldvalue, that corresponds to either the actual text of the button being tapped, or at least points to the original field that the merge field corresponds to.

 

Because there will be around 64 individual buttons, spread over 4 layouts, I am after an option that slows the ipad down the least. I don't mind doing an individual script for each button if it results in faster execution - just wondered if a single generic script would be as effective,

 

and how to possibly use a merge field value in a calculation (if possible).

 

TIA

an example file or screenshot would be nice...  You don't really mean a merge field do you (i.e. the kind of text that you can add in Layout mode with the command Insert >. Merge Field... )? 

 

Do you mean that you have conventional field of text, and that you'd first like to click on some point within the text, to place the insertion point where text is to be inserted?  Then you want to select a button in order to automatically insert text from another field into the text field at cursor's the insertion point?  

 

If so, then maybe the attached file is what you're after.

merge.fmp12.zip

  • Author

Actually Matthew,

 

That is exactly what I want.

 

You can see the layout below, shows a heap of button graphics with a merge-field value forming the label for the button.

 

Instead of having a unique script for each button, (which inserts the text value of the merge-field's original field value), and thus needing each script to point to the corresponding unique field value for insertion into the TxNotes field, I was just hoping there may be an expression that will allow me to have a generic script, applied to each button, that would simply insert the text value of the merge-field label contents.

 

Just trying to save myself a lot of script writing (there's 3 other pages with this sort of button labelling!)

 

 

(Image below is in Edit Layout view)

 

EquineChirov52-L.jpg

 

an example file or screenshot would be nice...  You don't really mean a merge field do you (i.e. the kind of text that you can add in Layout mode with the command Insert >. Merge Field... )? 

 

Do you mean that you have conventional field of text, and that you'd first like to click on some point within the text, to place the insertion point where text is to be inserted?  Then you want to select a button in order to automatically insert text from another field into the text field at cursor's the insertion point?  

 

If so, then maybe the attached file is what you're after.

Sorry, I meant to reply earlier... I can see what you mean about a lot of buttons!  

 

I think the fact that you have a bunch of merge fields as labels is kind of irrelevant.  You can still use the basic approach that I showed in my example file.  The same script is used for each of the buttons. However, each button uses a different script parameter to tell the script which data field to transmit.  In your case the script parameters would be "CAL::R1C1", "CAL::R1C2", etc. 

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.