laguna92651 Posted February 25, 2016 Posted February 25, 2016 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.
webko Posted February 25, 2016 Posted February 25, 2016 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?
laguna92651 Posted February 25, 2016 Author Posted February 25, 2016 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.
siroos12 Posted February 25, 2016 Posted February 25, 2016 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
comment Posted February 25, 2016 Posted February 25, 2016 (edited) 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 February 25, 2016 by comment
laguna92651 Posted February 25, 2016 Author Posted February 25, 2016 (edited) 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 Edited February 25, 2016 by laguna92651
comment Posted February 25, 2016 Posted February 25, 2016 Why don't you make the field itself a button?
laguna92651 Posted February 25, 2016 Author Posted February 25, 2016 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.
siroos12 Posted February 25, 2016 Posted February 25, 2016 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.
Recommended Posts
This topic is 3193 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 accountSign in
Already have an account? Sign in here.
Sign In Now