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

Need help using drop down list to calculate fields

robinsalvo
Level 1
Level 1

I am trying to use a drop down list to control how my field calculate. I have events packages that have multiple tiers. For example, Package One has (2) Tiers. Tier 1 costs $16 & Tier 2 costs $20. So based on the number of guests i want to be able to select the tier and it multiply and give me the total cost for the package. Ex: 2 Guests for Tier 1 = $32. Here is the code i have so far, it is placed under the change handler of the drop down list:

var costPerGuest = 16;

var tier = event.newText;

if (tier == "Tier 1"){

  costPerGuest = 16;}

else if (tier == "Tier 2"){

  costPerGuest = 20;}

Total.rawValue = String(Guests.rawValue * costPerGuest)

//Total.rawValue = DropDownList1.rawValue;

What happens is when I run this it will not change unless the number of guests will change. So for the example above, if i switch it to Tier 2 after selecting Tier 1, it will not change my Total from $32 to $40.

Any help would be greatly appreciated.

3 Replies
TundraSteve
Level 8
Level 8

If you use the calculate event of the Total field you'll have more luck.  As soon as you change the dropdown or the guests field it will update

Anonymous
Not applicable

Hi,

I think ,you can use the event of EXIT event of dropdown list.

var costPerGuest = 0;

if (this.rawValue == "Tier1")

{

  costPerGuest = 16;

}

else if (this.rawValue == "Tier2")

{

  costPerGuest = 20;

}

else

{

................................

}

total.rawValue = Guests.rawValue * costPerGuest;

Hope this helps,

S,Candy.

robinsalvo
Level 1
Level 1

Thank you Steve! This worked. I appreciate your help!