Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Posted

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

 

 

Posted (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 by comment
Posted (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

Screenshot - Edit.png

Screenshot -Good.png

Edited by laguna92651
Posted

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.

Posted
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.

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 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.