How to use variables to show a result from different discount and budget option?

Hi everyone…

…as I am pretty new to the topic of variables and already have watched tons of youtube videos and read stuff I still don’t get it logical :confused: I am not a native English speaker maybe that’s why and I couldn’t found any good explanation in German… so sorry for my grammar also…

Task:
First step: User (Entrepreneur) have to choose a specific discount (50% or 100%) which he would like to give on a specific various Budget which he want to provide for his costumers (employee)
Second: Then User have to choose which specific Budget he would like to offer his costumers.

His choice will be displayed as a Result (budget-amount) on the right (like e.g. Budget of 1000$ with 100% discount = 1000$ or Budget of 1000$ with 50% discount= 500$), but with different text blocks.

Problem:
After choosing the discount and budget, if I now change the discount again the Result doesn’t update to the current chosen specific budget.

I have extract only this part of the click dummy and trying to focus on the main problem. I hope you understand it anyway. Cost-Calculator-with-Discount.rp (60.8 KB)

Hope someone can help me out or have a Tip how to achieve this :raised_hands:

Very thankful for any help or ideas. Thank You!

PS: I know its maybe a bit confusing choosing first the discount, but its a special B2B use case to find out what it will cost an Entrepreneur to offer his employee a tax free budget for lunch checks etc.

I duplicated your page to Page 1 (1) to make changes.

  • Ungrouped things to edit them easier.
  • On 50% and 100% buttons, the Selected event only gets fired (called, triggered, enacted) when "is selected equals true" so the Case is unnecessary. (If "is selected equals false" then the Unselected event would be fired.
  • On the cost buttons, you have two idential actions for "Set Text +RESULT-Lunch to "xxx" which is unnecessary and might lead to bugs.
  • When 50% or 100% button is clicked/selected they need to evaluate which cost button is selected and do the same actions as if they had been clicked/selected. In Axure you can do this with the Fire Event action, choosing which widget to act upon and which event should be fired. So, I set up a series of cases to evaluate each of the 4 cost buttons and fire their Selected event (again) only if one is selected. (This was easily copied from the 50% button and pasted to 100% button.)
  • The interaction code on the cost buttons is good and seems to work correctly.
  • I copied the code in a generic and extensible way to the "1800 CHF" button, using some built-in String functions in mathematical formulas. This is a fancy way to do the same as you have "hard coded" the number values for the "960 CHF" button. But, with the formulas, I can copy and paste the entire Selected event to any of the cost buttons and it will work the same.
    • For instance, if you later need to change 2160 CHF to 3200 CHF the code will still work without needing to change its values.
    • Or, if you wanted to allow the user to enter any amount of money into a text field, that entry could be evaluated with this same code.

Cost-Calculator-with-Discount.rp (86.5 KB)

1 Like

oh damn… that’s awesome! “you live and learn” they said… I have learned now a lot…!!! thank you so much… will try to figure out how you did that and learn it that way much easier… will show you the final result with even more complexity with the results, if you want… that helps me a lot… thank! :raised_hands:

@mbc66 does make sense to use global variables for the amounts also? I have experimented with yesterday and it worked also well…

Yes, you could set a global variable for the discount amount, and perhaps a global variable for the selected cost button, and this could make the calculations easier. Particularly useful if you need to refer to these variables on other pages.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.