Jump to content

Button to navigate to next value in a Value List


Recommended Posts

  • Newbies

Hi All,

I have simple layout with a value list. This is a conditional value list that is changed based on a selection in the preceding field.

I basically want to create a simple "Next" button to go to the next value in a Value List and I can't think of a way to do this. I am playing with GetValue and ValueListItems but can't find a way to assess the current value of the field and then add a +1 to go to the next value. Any guidance would be greatly appreciated.

Link to post
Share on other sites

This is a little difficult to understand. If (as it seems) you have a field formatted as a drop-down list (or a pop-up menu), and you want to calculate the value that is next in the value list relative to the currently selected value, you could do something like:

Let ( [
listOfValues = ValueListItems ( "" ; "YourValueList" ) ;
i = ValueCount ( Left ( listOfValues ; Position ( ¶ & listOfValues & ¶ ; ¶ & YourField & ¶ ; 1 ; 1 ) ) )
] ;
GetValue ( listOfValues ; i + 1 )
)

Note that if YourField is empty or contains a value that is not in the value list, the result will be the 1st value in the value list. If YourField contains the last value in the value list, the result will be empty. If you prefer, this behavior can be changed to cycling over the value list by changing the last line to:

GetValue ( listOfValues ; Mod ( i ; ValueCount ( listOfValues ) ) + 1 )

 

 

  • Thanks 1
Link to post
Share on other sites
  • Newbies

Yes, this is exactly what I needed. Works wonderfully! Thank you so much for taking time to write this!

Link to post
Share on other sites

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.