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.

Featured Replies

Hi everyone!

I have a text field, with each sentence separated by ¶ .

I would like to create buttons for each line in this field, so that I can copy each line individually (and paste manually in different application for example)

I assume that it's easy to do in calculation with GetValue, and make a script using Get (ScriptParameter) = line number in that field, for each button. ( I ll need only 7-10 lines max).

1. I can't figure out what script function I need to use to make a selective copy...

2. If one of the option is Set Selection function - how would it work in my case?

Thank you!

Hello

That's a tricky one, and I guess could be achieved in many different ways.

You could have a script with the Set Selection script step that calculates the start and end point and makes the selection. Then add a 'Copy' script step after that. So it's just a two line script.

Start Point

Let ( 
[ 

sentenceNo = Get ( ScriptParameter ) ; 

] 

; 

If ( sentenceNo = 1 ; 1 ; Position ( SentenceTest::myTextField ; "¶" ; 1 ; sentenceNo - 1 ) + 1 ) 

)

End Point

Let ( 

[ 

sentenceNo = Get ( ScriptParameter ) ; 

countOccurencesOfCarriageReturn = PatternCount ( SentenceTest::myTextField ; "¶" ) 

] 

; 

If ( sentenceNo > countOccurencesOfCarriageReturn ; Length ( SentenceTest::myTextField) ; Position ( SentenceTest::myTextField ; "¶" ; 1 ; sentenceNo ) - 1) 

)

Then call that script with the script parameter matching the sentence you are trying to select. You could have a number of buttons, each of which selects a sentence (1, 2, 3) etc. You could also put hide conditions on those buttons so it only shows the correct number of buttons.

Still works if an extra carriage return has been put on the end of the last sentence.

Enclosed a sample file for you to see it in action!

SentenceTest.fmp12

I'd do it this way*:

SentenceTest2.fmp12

Note also that plugins such as Base Elements let you set the clipboard contents directly.

---

(*) Assuming I'd want to do this at all - which I doubt. It seems these "sentences" should be individual records in a related table. 

  • Author

Thank you very much, both solutions should work for me.

to comment;

I considered to make individual records for each sentence, but I thought there should be a way to avoid it...

Well, you showed the way!

Thanks again!

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.