-
December 14th, 2019, 13:29 #1
- Join Date
- May 2012
- Location
- France
- Posts
- 103
Can a checkbutton return a value?
Hi all,
I'm in trouble with a ruleset modification. To represent the different levels of a heathbar, i have five labels and a check type button associated at the end of each lines. Fresh, Weary, Tired, Dazed, and so on.
What i want to do is when the checkon state is activated, it returns the value "1", so i can use this in a subsequent field to calculate the right penalty. i.e. tired = 1 for checked button x (-3 for tired state) = -3
Actually i have a stringfield where i write "1". Can i swap it to a checkbox and have the "1" still counted? And how to do that?
Or to simplify, have the right penalty ported over when the button is checked. i.e tired = -3
Thanks by advance.Last edited by Maspalio; December 14th, 2019 at 13:32.
-
December 14th, 2019, 20:31 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,426
A buttonfield is stored as a number in the database. If it has more than one state, then the states will be numbers from 0 to n-1, where n is the number of button states. You can use getValue() and setValue() on a button control to retrieve or set the state.
You'll need to make sure that you work through the logic that you are trying to accomplish so that the data stored in the database is what you expect, and the fields that you are displaying to the user will update as you expect.
I was not able to understand exactly what you want to do, based on your description; so I can't be more specific.
Regards,
JPG
-
December 14th, 2019, 23:38 #3
If all your calculations are multiplications the 1 is irrelevant.
If check box is ticked and tired then penalty = -3
-
December 15th, 2019, 08:31 #4
- Join Date
- May 2012
- Location
- France
- Posts
- 103
Thanks to both of you, it was helpful.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks