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

Could I get some help on script to cycle through a set of values in a field. Each time I click on the target field I would like to cycle through a set of values; (Yes, No, Maybe and blank) and of course stop clicking when I get the value I want.

That seems the long way to do it... Surely a dropdown list (one click and scroll), or a radio button set (one click) would be more efficient?

  • Author

You're probably right, but I thought it might be quicker by cycling through, since most times when I would use the function, the selection would be one quick click, for Yes, one click and no scroll. Don't really have the room for radio buttons.

do as below:

 

Make a new scrip call it something has meaning for you. for example change values:

 

the script step would be:

Set Field [ Your table::Your field ; If(Your table::Your field="Yes";"No";If(Your table::Your field="No";"Maybe";If(Your table::Your field="Maybe";"";"Yes"))) ]

 

Then assign this script as a button script for that field on your layout. 

 

Please let me know if it does what you want ;)

 

Siroos

 

 

13 hours ago, laguna92651 said:

I would like to cycle through a set of values; (Yes, No, Maybe and blank)

Try setting the field to:

Let ( [
listOfValues = "Yes¶No¶Maybe¶¶" ;
n = ValueCount ( listOfValues ) ;
i = ValueCount ( Left ( listOfValues ; Position ( ¶ & listOfValues & ¶ ; ¶ & YourTable::YourField & ¶ ; 1 ; 1 ) ) )
] ;
GetValue ( listOfValues ; Mod ( i ; n  ) + 1 )
)

 

 

7 hours ago, siroos12 said:

Set Field [ Your table::Your field ; If(Your table::Your field="Yes";"No";If(Your table::Your field="No";"Maybe";If(Your table::Your field="Maybe";"";"Yes"))) ]

Learn about the Case() function:
http://www.filemaker.com/help/14/fmp/en/html/func_ref1.32.181.html#1071963

 

Edited by comment

  • Author

Thanks both scripts work great, I wanted to run the script when I clicked on the target field, so I attached the script to Set Script Trigger OnObjectEnter. The script will cycle through a couple of the selections then go into field edit mode. I have to click off of the field then back to the field to continue cycling. Can I add something to the script to prevent the edit mode?

Edit mode

Screenshot - Edit.png

Screenshot -Good.png

Edited by laguna92651

Why don't you make the field itself a button?

  • Author

Well, that was simple enough, actually the whole thing was fairly straight forward. Made a bigger thing out of it than I needed to. What was your thinking in using the GetValue function. Thanks much.

11 hours ago, comment said:

Try setting the field to:


Let ( [
listOfValues = "Yes¶No¶Maybe¶¶" ;
n = ValueCount ( listOfValues ) ;
i = ValueCount ( Left ( listOfValues ; Position ( ¶ & listOfValues & ¶ ; ¶ & YourTable::YourField & ¶ ; 1 ; 1 ) ) )
] ;
GetValue ( listOfValues ; Mod ( i ; n  ) + 1 )
)

 

 

Learn about the Case() function:
http://www.filemaker.com/help/14/fmp/en/html/func_ref1.32.181.html#1071963

 

Thanks mate, I will definitely read and learn ;) Appreciated.

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.