6 Replies Latest reply on Mar 15, 2013 1:10 PM by hanstrager

# How to assign functions to radio buttons..?

### Title

How to assign functions to radio buttons..?

### Post

Im trying to make a small aplication to keep track of reciepts. Some times I have reciept in various currencies, i need to have converted into one currency so i can make full overviews of spending etc.

1 set of radiobuttons with the following value list:

Pounds
Euros
Dollars

3 global fields called: ConversionDollar, ConversionEuro & ConversionPound

1 number field called: TotalAmountReceipt

1 calculation field called: TotalAmount

What I can't figure out how to do, is when i put in the amount from my receipt in my field called "TotalAmount". I need to push one of the radiobuttons depending what currency is stated on the receipts and then based on one of my 3 currency conversions in my global fields, calculate how much the thing is in the field called "TotalAmount"

Further more i want it to change the color of the text depending, if it's in dollar, euros or pounds.

sofar i have the following calculation in my calculation field "TotalAmount":

Case ( If (currency buttons = "Euros" ; TotalAmountReceipt * Globals::ConversionEuro) ;  If (currency buttons = "Dollars" ; TotalAmountReceipt * Globals::ConversionDollar) ; If (currency buttons = "Pounds" ; TotalAmountReceipt * Globals::ConversionPound) )

for whatever reason only the pund button is working, and I'm not sure how to approach the differetent color challenge..? does anyone know if this is possible..?

• ###### 1. Re: How to assign functions to radio buttons..?

You should have:

Case ( currency buttons = "Euros" ; TotalAmountReceipt * Globals::ConversionEuro ;
currency buttons = "Dollars" ; TotalAmountReceipt * Globals::ConversionDollar ;
currency buttons = "Pounds" ; TotalAmountReceipt * Globals::ConversionPound )

If it still doesn't work, you'll need to check a few details:

Make sure that Currency Buttons is a field of type "Text".
Make sure that the quoted text in the case function is exactly the same as a value from the radio button's value list. (If the radio button says "Dollar", the above expression that refers to "Dollars" won't be true.)
If the this is for a number field with an auto-entered calculation as it should be so defined, make sure that the "do not replace existing values..." check box is not selected.

Ps. You want this to be an auto-entered calc so that future changes to an exchange rate do not alter what you entered in previous transactions that took place before the rate changed.

Also note that making changes to an auto-enter calculation will not automatically update data in existing records. The field will only update for new records or in records where you modify the value in a "trigger field" such as the radio button field this calculation references.

• ###### 2. Re: How to assign functions to radio buttons..?

It was the "do not replace existing values..." That was not unchecked which caused the problem, is it possible to make the text change color in the TotalAmount field based on whether it's dollar, euros or pounds that's selected..?

• ###### 3. Re: How to assign functions to radio buttons..?

A conditional format can be used to change the color.

There's also a textcolor function that can be used inside the 3 different calcuations inside the case function.

• ###### 4. Re: How to assign functions to radio buttons..?

I tried this to see what would happen when i pressed the euro radiobutton. It should go blue, but nothing happens in TotalAmount..? has it something to do with TotalAmount is a numberfield, or is it me who has got it completely wrong..?

Case ( currency buttons = "Euros" ; TotalAmountReceipt * Globals::ConversionEuro ;
currency buttons = "Euros" ; TextColor ( TotalAmount ; RGB ( 0 ; 0 ; 255 ) );
currency buttons = "Dollars" ; TotalAmountReceipt * Globals::ConversionDollar ;
currency buttons = "Pounds" ; TotalAmountReceipt * Globals::ConversionPound )

• ###### 5. Re: How to assign functions to radio buttons..?

Why not use a conditional format? That would seem the simpler approach.

Your case function should be this:

Case ( currency buttons = "Euros" ; TextColor ( TotalAmountReceipt * Globals::ConversionEuro ; RGB ( 0 ; 0 ; 255 ) ) ;
currency buttons = "Dollars" ; TotalAmountReceipt * Globals::ConversionDollar ;
currency buttons = "Pounds" ; TotalAmountReceipt * Globals::ConversionPound )

Your existing function fails because in a case function, only the first expression that evaluates as true will return a result. Thus, it is impossible for the added code that assigned a color to execute.

• ###### 6. Re: How to assign functions to radio buttons..?

Works Perfect thank you so much for your help again