Jump to content

Cycle through values in a field


This topic is 2981 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 2981 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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