Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Calculation

_Win_Lam_
Level 2
Level 2
Can any great genius pls help me out on this?<br /><br />I have a radio button with options of selecting a 5% or 10% discount and a Total Price numeric field.<br /><br />I need help in creating a script for:<br /><br />If Radio Button is selected then<br />Total Price = Sum(a,b,c) <already on FormCalc/Calculate Event> * Price Discount <radio Button in ExclGroup><br /><br />Please help... i've been working on it for days...
5 Replies
Ruytero-HzmPcE
Level 4
Level 4
Hi Win,



Can't you make an if-statement to see wich rdo is selected and then calculate that discount?



Regards,
_Win_Lam_
Level 2
Level 2
Hi Ronny,<br />I'm sorry i guess i'm too new to have understand your question to script on the above.<br /><br />Currently, i have a Total Price field at calculate event on <FormCalc>with the following:<br /><br />$.rawValue = Sum (a,b,c) * Prem: computation is accurate but Total Price is not reflected in the field when the Discount <Radio button> is not selected.<br /><br />So when i transform the script language to Javascript, it doesn't work at all.<br /><br />So i want the premium to be reflected even when radio button is not selected and then calculate the actual Total Price when form filler selects the type of discount.<br /><br />Can you help on this?
Ruytero-HzmPcE
Level 4
Level 4
Hi Win,



I created a sample below is the formcalc script I have on the calculate-event of the Total-field.



if (rdoDiscount.rawValue eq "5") then

$ = (Sum(numVal[*]) * (5/100)) + Sum(numVal[*]);

elseif (rdoDiscount.rawValue eq "10") then

$ = (Sum(numVal[*]) * (10/100)) + Sum(numVal[*]);

elseif (rdoDiscount.rawValue eq "15") then

$ = (Sum(numVal[*]) * (15/100)) + Sum(numVal[*]);

else

$ Sum(numVal[*]);

endif



For the rest I have two value fields (both named numVal)

and three radiobuttons with the value specified in the Binding properties.



If you would like the sample I can mail it to you.



Regards,



RonnyR
Not applicable
Hi,

I think that a good solution could be use a drop-down-list (if you can)

In his Exit event you can call a function to whom pass the value selected.





obviously the function makes the calculations you want.



No "if" statement and better maintenance of the code 🙂



I hope this helps.



Roberto Bellarmino
_Win_Lam_
Level 2
Level 2
Dear Ronny,

Thanks so much.



Yes, maybe if you can mail me the sample for a better reference.

Sorry for the trouble.



Regards,

Win